You are here

function insert_media_field_widget_form_alter in Insert 8.2

Implements hook_field_widget_form_alter().

File

modules/insert_media/insert_media.module, line 215

Code

function insert_media_field_widget_form_alter(array &$element, FormStateInterface $form_state, array $context) {

  /** @var \Drupal\Core\Field\WidgetInterface $plugin */
  $plugin = $context['widget'];
  $pluginId = $plugin
    ->getPluginId();
  if (InsertUtility::isSourceWidget($pluginId, INSERT_TYPE_MEDIA)) {
    $element['#insert_media'] = [
      'settings' => _insert_media_settings($plugin),
    ];
  }
}