function paragraphs_features_field_widget_multivalue_form_alter in Paragraphs Features 8
Same name and namespace in other branches
- 2.x paragraphs_features.module \paragraphs_features_field_widget_multivalue_form_alter()
Implements hook_field_widget_multivalue_form_alter().
File
- ./
paragraphs_features.module, line 18 - Contains hooks for Paragraphs Feature module.
Code
function paragraphs_features_field_widget_multivalue_form_alter(array &$elements, FormStateInterface $form_state, array $context) {
/** @var \Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget $widget */
$widget = $context['widget'];
if (!$widget instanceof ParagraphsWidget) {
return;
}
// For compatibility with Drag & Drop in Paragraphs.
if (!empty($elements['#field_name'])) {
$fieldWrapperId = ParagraphsFeatures::getWrapperId($context['form']['#parents'], $elements['#field_name']);
ParagraphsFeatures::registerFormWidgetFeatures($elements, $widget, $fieldWrapperId);
}
}