You are here

function insert_field_widget_form_alter in Insert 8.2

Implements hook_field_widget_form_alter().

File

./insert.module, line 737

Code

function insert_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)) {
    $element['#insert'] = [
      'id' => NULL,
      'settings' => _insert_settings($plugin),
      'type' => _insert_get_insert_type($pluginId),
    ];
  }
}