contact_form_user_admin_settings_alter(&$form, FormStateInterface $form_state)
Implements hook_form_FORM_ID_alter().
Add the default personal contact setting on the user settings page.
\Drupal\user\AccountSettingsForm
function contact_form_user_admin_settings_alter(&$form, FormStateInterface $form_state) {
$form['contact'] = array(
'#type' => 'details',
'#title' => t('Contact settings'),
'#open' => TRUE,
'#weight' => 0,
);
$form['contact']['contact_default_status'] = array(
'#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';
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!contact!contact.module/function/contact_form_user_admin_settings_alter/8.1.x