diff --git a/govcms.profile b/govcms.profile index 4c60c13c0..586552174 100644 --- a/govcms.profile +++ b/govcms.profile @@ -71,3 +71,17 @@ function govcms_field_widget_form_alter(&$element, FormStateInterface $form_stat // $context['widget']->getPluginId(). \Drupal::theme()->alter(['field_widget_form'], $element, $form_state, $context); } + +/** + * Implements hook_field_widget_multivalue_form_alter(). + */ +function govcms_field_widget_multivalue_form_alter(&$elements, FormStateInterface $form_state, $context) { + // In Drupal 7 `hook_field_widget_multivalue_form_alter` could be implemented + // by the theme, but in Drupal 8 this hook changed to being module-only. + // This hook can be critical for improving the editor experience for things + // like paragraphs. Implementing themes can access the plugin ID via + // $context['widget']->getPluginId(). + \Drupal::theme()->alter([ + 'field_widget_multivalue_form', + ], $elements, $form_state, $context); +}