Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 3
CRAP
n/a
0 / 0
template_preprocess_crm_contact
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
template_preprocess_crm_relationship
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
crm_form_block_form_alter
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * @file
5 * Provides a contact entity type.
6 */
7
8use Drupal\Core\Render\Element;
9use Drupal\Core\Form\FormStateInterface;
10
11/**
12 * Prepares variables for contact templates.
13 *
14 * Default template: crm-contact.html.twig.
15 *
16 * @param array $variables
17 *   An associative array containing:
18 *   - elements: An associative array containing the contact information and any
19 *     fields attached to the entity.
20 *   - attributes: HTML attributes for the containing element.
21 */
22function template_preprocess_crm_contact(array &$variables) {
23  $variables['view_mode'] = $variables['elements']['#view_mode'];
24  foreach (Element::children($variables['elements']) as $key) {
25    $variables['content'][$key] = $variables['elements'][$key];
26  }
27}
28
29/**
30 * Prepares variables for crm relationship templates.
31 *
32 * Default template: crm-relationship.html.twig.
33 *
34 * @param array $variables
35 *   An associative array containing:
36 *   - elements: An associative array containing the relationship and any
37 *     fields attached to the entity.
38 *   - attributes: HTML attributes for the containing element.
39 */
40function template_preprocess_crm_relationship(array &$variables) {
41  $variables['view_mode'] = $variables['elements']['#view_mode'];
42  foreach (Element::children($variables['elements']) as $key) {
43    $variables['content'][$key] = $variables['elements'][$key];
44  }
45}
46
47/**
48 * Implements hook_form_FORM_ID_alter().
49 */
50function crm_form_block_form_alter(&$form, FormStateInterface $form_state) {
51  $form['#attached']['library'][] = 'crm/crm.block';
52}