class FormNodeFormAlter in General Data Protection Regulation Compliance 8
Hook hook_form_node_alter().
Hierarchy
- class \Drupal\gdpr_compliance\Hook\FormNodeFormAlter
Expanded class hierarchy of FormNodeFormAlter
1 file declares its use of FormNodeFormAlter
- gdpr_compliance.module in ./
gdpr_compliance.module - Contains Hooks.
File
- src/
Hook/ FormNodeFormAlter.php, line 11
Namespace
Drupal\gdpr_compliance\HookView source
class FormNodeFormAlter {
/**
* Hook.
*/
public static function hook(&$form, FormStateInterface $form_state, $form_id) {
$display = FALSE;
$config = \Drupal::config('gdpr_compliance.settings');
if ($config
->get('node-mode') == 'all') {
$display = TRUE;
}
elseif ($config
->get('node-mode') == 'custom') {
$bundles = $config
->get('node-bundles');
$formkey = substr($form_id, 5, -5);
if (isset($bundles[$formkey]) && $bundles[$formkey]) {
$display = TRUE;
}
}
if ($display) {
FormWarning::addWarning($form);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FormNodeFormAlter:: |
public static | function | Hook. |