public static function AsyncMetatagFirehose::ajaxFormRefresh in Metatag Asynchronous Widget 1.0.x
Ajax callback for the "Customize meta tags" button.
File
- src/
Plugin/ Field/ FieldWidget/ AsyncMetatagFirehose.php, line 29
Class
- AsyncMetatagFirehose
- Asynchronous widget for the Metatag field.
Namespace
Drupal\metatag_async_widget\Plugin\Field\FieldWidgetCode
public static function ajaxFormRefresh(array $form, FormStateInterface $form_state) {
$triggering_element = $form_state
->getTriggeringElement();
// This will be placed inside a details element so remove everything that
// would make add a nested details element.
$form = NestedArray::getValue($form, array_slice($triggering_element['#array_parents'], 0, -1));
$children = Element::children($form);
$form = array_intersect_key($form, array_flip($children));
return $form;
}