editor_form_filter_admin_overview_alter(&$form, FormStateInterface $form_state)
Implements hook_form_FORM_ID_alter().
File
- core/modules/editor/editor.module, line 85
- Adds bindings for client-side "text editors" to text formats.
Code
function editor_form_filter_admin_overview_alter(&$form, FormStateInterface $form_state) { // @todo Cleanup column injection: https://www.drupal.org/node/1876718. // Splice in the column for "Text editor" into the header. $position = array_search('name', $form['formats']['#header']) + 1; $start = array_splice($form['formats']['#header'], 0, $position, array('editor' => t('Text editor'))); $form['formats']['#header'] = array_merge($start, $form['formats']['#header']); // Then splice in the name of each text editor for each text format. $editors = \Drupal::service('plugin.manager.editor')->getDefinitions(); foreach (Element::children($form['formats']) as $format_id) { $editor = editor_load($format_id); $editor_name = ($editor && isset($editors[$editor->getEditor()])) ? $editors[$editor->getEditor()]['label'] : '—'; $editor_column['editor'] = array('#markup' => $editor_name); $position = array_search('name', array_keys($form['formats'][$format_id])) + 1; $start = array_splice($form['formats'][$format_id], 0, $position, $editor_column); $form['formats'][$format_id] = array_merge($start, $form['formats'][$format_id]); } }
Please login to continue.