Prepares variables for modal form add widget template.
Default template: paragraphs-add-dialog.html.twig
array $variables: An associative array containing:
function template_preprocess_paragraphs_add_dialog(&$variables) {
// Define variables for the template.
$variables += [
'buttons' => [],
];
foreach (Element::children($variables['element']) as $key) {
if ($key == 'add_modal_form_area') {
// $add variable for the add button.
$variables['add'] = $variables['element'][$key];
}
elseif ($key == 'add_more_delta') {
// Add the delta to the add wrapper.
$variables['add'][$key] = $variables['element'][$key];
}
else {
// Buttons for the paragraph types in the modal form.
$variables['buttons'][$key] = $variables['element'][$key];
}
}
}