-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite_information.module
More file actions
30 lines (23 loc) · 846 Bytes
/
site_information.module
File metadata and controls
30 lines (23 loc) · 846 Bytes
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
<?php
/**
* @file
* Add a field to a site information form.
*/
/**
* Implement hook_form_FORM_ID_alter().
*/
function site_information_form_system_site_information_settings_alter(&$form, $form_state, $form_id) {
$form['site_information']['site_information_apikey'] = array(
'#type' => 'textfield',
'#title' => t('Site API Key'),
'#default_value' => \Drupal::config('system.site')->get('site_information_apikey'),
);
$form['actions']['submit']['#value'] = t('Update Configuration');
$form['#submit'][] = 'system_site_information_set_value';
}
/**
* @callback function
*/
function system_site_information_set_value($form, &$form_state) {
\Drupal::configFactory()->getEditable('system.site')->set('site_information_apikey', $form_state->getValue('site_information_apikey'))->save();
}