function Ckeditor5ReadOnlyModeHooks::formNodePageFormAlter
Same name and namespace in other branches
- main core/modules/ckeditor5/tests/modules/ckeditor5_read_only_mode/src/Hook/Ckeditor5ReadOnlyModeHooks.php \Drupal\ckeditor5_read_only_mode\Hook\Ckeditor5ReadOnlyModeHooks::formNodePageFormAlter()
Implements hook_form_FORM_ID_alter().
Attributes
#[Hook('form_node_page_form_alter')]
File
-
core/
modules/ ckeditor5/ tests/ modules/ ckeditor5_read_only_mode/ src/ Hook/ Ckeditor5ReadOnlyModeHooks.php, line 18
Class
- Ckeditor5ReadOnlyModeHooks
- Hook implementations for ckeditor5_read_only_mode.
Namespace
Drupal\ckeditor5_read_only_mode\HookCode
public function formNodePageFormAlter(array &$form, FormStateInterface $form_state, string $form_id) : void {
$form['body']['#disabled'] = \Drupal::state()->get('ckeditor5_read_only_mode_body_enabled', FALSE);
$form['field_second_ckeditor5_field']['#disabled'] = \Drupal::state()->get('ckeditor5_read_only_mode_second_ckeditor5_field_enabled', FALSE);
$form['field_ckeditor5_disable']['#states'] = [
'disabled' => [
':input[name="field_ckeditor5_toggle[value]"]' => [
'checked' => TRUE,
],
],
];
$form['field_ckeditor5_enable']['#disabled'] = TRUE;
$form['field_ckeditor5_enable']['#states'] = [
'enabled' => [
':input[name="field_ckeditor5_toggle[value]"]' => [
'checked' => TRUE,
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.