Commit b7c5716d authored by Stefan Borchert's avatar Stefan Borchert Committed by Stefan Borchert
Browse files

Issue #3273278 by stBorchert: Add-in-between does not work / all elements are added at the end

parent 78988069
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -277,10 +277,12 @@ function template_preprocess_paragraphs_add_dialog__categorized(&$variables) {
  // Define variables for the template.
  $variables += ['buttons' => []];
  $variables['add_mode'] = isset($variables['element']['#add_mode']) ? $variables['element']['#add_mode'] : 'modal';
  $variables['add'] = [];
  if (isset($variables['element']['add_modal_form_area'])) {
    $variables['add'] = $variables['element']['add_modal_form_area'];
    $variables['add']['#attributes']['class'][] = 'paragraph-type-add-delta';
    $variables['add']['#attributes']['class'][] = $variables['add_mode'];
    $variables['add']['add_modal_form_area'] = $variables['element']['add_modal_form_area'];
  }
  if (isset($variables['element']['add_more_delta'])) {
    $variables['add']['add_more_delta'] = $variables['element']['add_more_delta'];
  }
  /** @var \Drupal\paragraphs_ee\ParagraphsCategoryInterface[] $categories */
  $paragraphs_categories = \Drupal::entityTypeManager()->getStorage('paragraphs_category')