You are here

function paragraphs_ee_sets_preprocess_paragraphs_add_dialog__categorized in Paragraphs Editor Enhancements 8

Override variables used in paragraphs-add-dialog--categorized.html.twig.

File

modules/paragraphs_ee_sets/paragraphs_ee_sets.module, line 101
Main functions for "Paragraphs Sets Editor Enhancements" module.

Code

function paragraphs_ee_sets_preprocess_paragraphs_add_dialog__categorized(&$vars) {
  $vars['groups']['paragraphs_sets'] = [];
  foreach (Element::children($vars['element']) as $key) {
    if (strpos($key, 'append_selection_button_') === 0) {

      // Buttons for the paragraph sets in the modal form.
      $button = $vars['element'][$key];
      $button['#attributes']['aria-describedby'] = $button['#id'] . '--description';
      $vars['groups']['paragraphs_sets'][] = $button;
    }
  }
  if (!empty($vars['groups']['paragraphs_sets'])) {

    // Add new button group.
    $vars['categories']['paragraphs_sets'] = [
      'id' => Html::getUniqueId($vars['element']['#id'] . '-category-paragraphs_sets'),
      'title' => t('Paragraphs Sets', [], [
        'context' => 'Paragraphs EE Sets: categories',
      ]),
      'description' => '',
    ];
  }
}