function contact_form_user_admin_settings_alter
Same name in other branches
- 7.x modules/contact/contact.module \contact_form_user_admin_settings_alter()
- 9 core/modules/contact/contact.module \contact_form_user_admin_settings_alter()
- 10 core/modules/contact/contact.module \contact_form_user_admin_settings_alter()
- 11.x core/modules/contact/contact.module \contact_form_user_admin_settings_alter()
Implements hook_form_FORM_ID_alter().
Add the default personal contact setting on the user settings page.
See also
\Drupal\user\AccountSettingsForm
File
-
core/
modules/ contact/ contact.module, line 217
Code
function contact_form_user_admin_settings_alter(&$form, FormStateInterface $form_state) {
$form['contact'] = [
'#type' => 'details',
'#title' => t('Contact settings'),
'#open' => TRUE,
'#weight' => 0,
];
$form['contact']['contact_default_status'] = [
'#type' => 'checkbox',
'#title' => t('Enable the personal contact form by default for new users'),
'#description' => t('Changing this setting will not affect existing users.'),
'#default_value' => \Drupal::configFactory()->getEditable('contact.settings')
->get('user_default_enabled'),
];
// Add submit handler to save contact configuration.
$form['#submit'][] = 'contact_form_user_admin_settings_submit';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.