Make CKEDITOR Caption Required
-
19-02-2021 - |
La solution
The CKEditor image dialog is a form, so you can change it via Drupal Form API with hook_form_alter
:
/**
* Implements hook_form_alter().
*/
function MyModule_form_alter(&$form, $form_state, $form_id) {
// Check if the form is editor_image_dialog.
if ($form_id == 'editor_image_dialog') {
// Make caption required.
$form['caption']['#required'] = TRUE;
// Change default_value to true.
$form['caption']['#default_value'] = TRUE;
}
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à drupal.stackexchange