-
Brian Canini authoredBrian Canini authored
asc_bootstrap.theme 1.55 KiB
<?php
/**
* @file
* Bootstrap sub-theme.
*
* Place your custom PHP code in this file.
*/
function asc_bootstrap_preprocess_page(&$vars, $hook) {
// Render the library as laid out in herchel.libraries.yml
$libraries['#attached']['library'][] = 'asc_bootstrap/asc_bootstrap-corescripts';
drupal_render($libraries);
//adds site name variable which is used as logo alt and title text
$vars['site_name'] = \Drupal::config('system.site')->get('name');
}
//create another suggestion based on the block type
/* function asc_bootstrap_theme_suggestions_block_alter(array &$suggestions, array $variables) {
function asc_bootstrap_theme_suggestions_block_alter(array &$suggestions, array $variables) {
>>>>>>> a03c8d80522d837a9acc6a1213d7ad7e61dc9e51
// Block suggestions for custom block bundles.
if (isset($variables['elements']['content']['#block_content'])) {
array_splice($suggestions, 1, 0, 'block__bundle__' . $variables['elements']['content']['#block_content']->bundle());
}
} */
/*
* adds content type to theme suggestions so that landing page doesn't default to page.html.twig
*/
function asc_bootstrap_theme_suggestions_page_alter(array &$suggestions, array $variables) {
if ($node = \Drupal::routeMatch()->getParameter('node')) {
$content_type = $node->bundle();
$suggestions[] = 'page__'.$content_type;
}
}
/*
* adds content type to variable to be used in paragraph twig files
*/
function asc_bootstrap_preprocess_paragraph(&$variables) {
$node = \Drupal::request()->attributes->get('node');
$variables['page_content_type'] = $node->getType();
}