function template_preprocess_printable_footer in Printer and PDF versions for Drupal 8+ 8
Same name and namespace in other branches
- 2.x printable.module \template_preprocess_printable_footer()
Preprocess variables for list of printable printer friendly page.
Parameters
array $variables: An associative array containing
- elements: Array of participant names. Array keys: #source_url, #footer_links, #footer_content.
File
- ./
printable.module, line 158 - Provides printer friendly content entities.
Code
function template_preprocess_printable_footer(array &$variables) {
global $base_url;
// Create source url over here.
$source_url = \Drupal::service('path.current')
->getPath();
$pos = strpos($source_url, "printable");
$source_url = substr($source_url, 0, $pos - 1);
$source_url = $base_url . \Drupal::service('path.alias_manager')
->getAliasByPath($source_url);
$variables['source_url'] = $source_url;
if (\Drupal::service('config.factory')
->get('printable.settings')
->get('list_attribute')) {
$links = $variables['footer_content'];
$split_links = explode(',', $links);
$new_array = array_unique($split_links);
$variables['footer_links'] = $new_array;
}
}