-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdadata_integration.module
More file actions
37 lines (34 loc) · 1.39 KB
/
dadata_integration.module
File metadata and controls
37 lines (34 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* @file
* Contains dadata.module.
*/
/**
* Implements hook_page_attachments().
*/
function dadata_integration_page_attachments(array &$attachments) {
$config = \Drupal::config('dadata_integration.import');
$module_dir = drupal_get_path('module', 'dadata_integration');
$attachments['#attached']['library'][] = 'dadata_integration/finder';
$attachments['#attached']['drupalSettings']['dadata'] = [
'builder' => [
'path' => "/{$module_dir}/assets/js/dist/dadata_init.js",
'style' => "/{$module_dir}/assets/style/css/dadata.css",
'elements' => $config->get('elements'),
'is_attach' => FALSE,
],
'api_key' => $config->get('api_key'),
];
// Call hook_dadata_attach_alter().
\Drupal::moduleHandler()->alter('dadata_attach', $attachments);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function dadata_integration_form_contact_message_feedback_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
$form['field_email']['widget']['0']['value']['#attributes']['class'][] = 'dd-email';
$form['field_name']['widget']['0']['value']['#attributes']['class'][] = 'dd-fio';
$form['field_org']['widget']['0']['value']['#attributes']['class'][] = 'dd-party';
$form['field_bank']['widget']['0']['value']['#attributes']['class'][] = 'dd-bank';
$form['field_address']['widget']['0']['value']['#attributes']['class'][] = 'dd-address';
}