You are here

function n1ed_field_widget_form_alter in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Implements hook_field_widget_form_alter().

Alters widget forms that have Flmngr enabled.

File

./n1ed.module, line 58
Main code for N1ED module.

Code

function n1ed_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
  $widgets = [
    'image_image',
    'file_generic',
  ];
  if (in_array($context['widget']
    ->getPluginId(), $widgets) && \Drupal::config('n1ed.settings')
    ->get('useFlmngrOnFileFields')) {
    $class = 'Drupal\\n1ed\\N1edFileField';
    $element['#process'][] = [
      $class,
      'processWidget',
    ];
  }
}