function pagerer_element_info_alter in Pagerer 8
Same name and namespace in other branches
- 8.2 pagerer.module \pagerer_element_info_alter()
Implements hook_element_info_alter().
Pagerer replaces the 'pager' theme defined in the 'pager' element type with the 'pagerer' theme and defined preset, if set so in configuration. This configuration setting impacts the rendered pages in case of change, so its cache tags are associated.
File
- ./
pagerer.module, line 80 - Pagerer.
Code
function pagerer_element_info_alter(array &$types) {
if (isset($types['pager'])) {
// Add a pre render callback to associate config:pagerer.settings to
// cache tags.
$types['pager']['#pre_render'][] = '\\Drupal\\pagerer\\PagererCache::preRenderPager';
// If configured to replace core pager, alter the pager #type theme.
$override_preset_id = \Drupal::config('pagerer.settings')
->get('core_override_preset');
if ($override_preset_id !== 'core') {
$types['pager']['#theme'] = 'pagerer';
$types['pager']['#config'] = [
'preset' => $override_preset_id,
];
}
}
}