class FormTestHooks
Hook implementations for form_test.
Hierarchy
- class \Drupal\form_test\Hook\FormTestHooks
Expanded class hierarchy of FormTestHooks
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ Hook/ FormTestHooks.php, line 13
Namespace
Drupal\form_test\HookView source
class FormTestHooks {
/**
* Implements hook_form_FORM_ID_alter().
*/
public function blockFormFormTestAlterFormAlter(&$form, FormStateInterface $form_state) : void {
\Drupal::messenger()->addStatus('block_form_form_test_alter_form_alter() executed.');
}
/**
* Implements hook_form_alter().
*/
public function formAlter(&$form, FormStateInterface $form_state, $form_id) : void {
if ($form_id == 'form_test_alter_form') {
\Drupal::messenger()->addStatus('form_test_form_alter() executed.');
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
public function formFormTestAlterFormAlter(&$form, FormStateInterface $form_state) : void {
\Drupal::messenger()->addStatus('form_test_form_form_test_alter_form_alter() executed.');
}
/**
* Implements hook_form_FORM_ID_alter().
*/
public function systemFormFormTestAlterFormAlter(&$form, FormStateInterface $form_state) : void {
\Drupal::messenger()->addStatus('system_form_form_test_alter_form_alter() executed.');
}
/**
* Implements hook_form_FORM_ID_alter() for the registration form.
*/
public function formUserRegisterFormAlter(&$form, FormStateInterface $form_state) : void {
$form['test_rebuild'] = [
'#type' => 'submit',
'#value' => t('Rebuild'),
'#submit' => [
'form_test_user_register_form_rebuild',
],
];
}
/**
* Implements hook_form_FORM_ID_alter() for form_test_vertical_tabs_access_form().
*/
public function formFormTestVerticalTabsAccessFormAlter(&$form, &$form_state, $form_id) : void {
$form['vertical_tabs1']['#access'] = FALSE;
$form['vertical_tabs2']['#access'] = FALSE;
$form['tabs3']['#access'] = TRUE;
$form['fieldset1']['#access'] = FALSE;
$form['container']['#access'] = FALSE;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
FormTestHooks::blockFormFormTestAlterFormAlter | public | function | Implements hook_form_FORM_ID_alter(). |
FormTestHooks::formAlter | public | function | Implements hook_form_alter(). |
FormTestHooks::formFormTestAlterFormAlter | public | function | Implements hook_form_FORM_ID_alter(). |
FormTestHooks::formFormTestVerticalTabsAccessFormAlter | public | function | Implements hook_form_FORM_ID_alter() for form_test_vertical_tabs_access_form(). |
FormTestHooks::formUserRegisterFormAlter | public | function | Implements hook_form_FORM_ID_alter() for the registration form. |
FormTestHooks::systemFormFormTestAlterFormAlter | public | function | Implements hook_form_FORM_ID_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.