Commit 17ad988b authored by Ethan Teague's avatar Ethan Teague Committed by Patrick Fey
Browse files

Issue #3269733 by EthanT, FeyP: Paging does not work in modal

parent bb4dc98c
Loading
Loading
Loading
Loading
+0 −44
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
 * General hook implementations of HTML Tag Usage module.
 */

use Drupal\Core\Template\Attribute;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

@@ -34,46 +33,3 @@ function html_tag_usage_help($route_name, RouteMatchInterface $route_match) {
  ];
  return $build;
}

/**
 * Implements hook_preprocess_HOOK() for pager.twig.html.
 *
 * @todo Remove once Drupal Core issue 3122526 has been fixed.
 *
 * @see https://www.drupal.org/project/drupal/issues/3122526
 */
function html_tag_usage_preprocess_pager(&$variables) {
  // Target our route instead of all modal dialogs so that we don't mess around
  // with other people's pagers.
  if (\Drupal::routeMatch()->getRouteName() !== 'html_tag_usage.report.inspect') {
    return;
  }

  $link_attributes = [
    'class' => ['use-ajax'],
    'data-dialog-type' => 'modal',
  ];
  $attribute = new Attribute($link_attributes);

  $links = [
    'first',
    'previous',
    'next',
    'last',
  ];
  foreach ($links as $link) {
    if (!isset($variables['items'][$link]['attributes'])) {
      continue;
    }
    $variables['items'][$link]['attributes']->merge($attribute);
  }

  if (isset($variables['items']['pages'])) {
    foreach ($variables['items']['pages'] as $i => $page) {
      if (!isset($variables['items']['pages'][$i]['attributes'])) {
        continue;
      }
      $variables['items']['pages'][$i]['attributes']->merge($attribute);
    }
  }
}
+0 −7
Original line number Diff line number Diff line
@@ -218,13 +218,6 @@ class Analyzer {
              'tag' => Html::escape($record->tag),
              'attribute' => Html::escape($record->attribute),
            ]),
            '#attributes' => [
              'class' => [
                'use-ajax',
              ],
              'data-dialog-type' => 'modal',
              'data-dialog-options' => '{"width":"80%", "minHeight": "80%"}',
            ],
          ],
        ],
      ];