/Drupal 8

function editor_form_filter_admin_format_validate

editor_form_filter_admin_format_validate($form, FormStateInterface $form_state)

Additional validate handler for filter_format_form().


core/modules/editor/editor.module, line 201
Adds bindings for client-side "text editors" to text formats.


function editor_form_filter_admin_format_validate($form, FormStateInterface $form_state) {
  // This validate handler is not applicable when using the 'Configure' button.
  if ($form_state->getTriggeringElement()['#name'] === 'editor_configure') {

  // When using this form with JavaScript disabled in the browser, the
  // 'Configure' button won't be clicked automatically. So, when the user has
  // selected a text editor and has then clicked 'Save configuration', we should
  // point out that the user must still configure the text editor.
  if ($form_state->getValue(['editor', 'editor']) !== '' && !$form_state->get('editor')) {
    $form_state->setErrorByName('editor][editor', t('You must configure the selected text editor.'));

© 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.