This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function THEME_theme_suggestions_form_alter(array &$suggestions, array $variables) { | |
$suggestions[] = 'form__' . $variables['element']['#form_id']; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ link(content.field_products_image, content.field_products_read_more[0]['#url'], { 'class':['class-link']} ) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_preprocess_page(&$variables) { | |
if ($variables['is_front']) { | |
$variables['#attached']['library'][] = 'my_theme/googleMap'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_preprocess_node(&$variables) { | |
if (($variables['elements']['#attributes']['data-history-node-id']) == 10) { | |
$variables['attributes']['class'][] = 'about-us-'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_theme_suggestions_page_alter(array &$suggestions, array $variables) { | |
// Naming templates based on page title. | |
if ($node = \Drupal::routeMatch()->getParameter('node')) { | |
$translation = $node->getTranslation('en'); | |
$suggestions[] = 'page__node__' . strtolower($translation->title->value); | |
$title = $node->getTitle(); | |
foreach ($suggestions as &$replace) { | |
$replace = str_replace(' ', '_', $replace); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hook_preprocess_html(&$variables) { | |
// Add node title as body class. | |
if ($node = \Drupal::routeMatch()->getParameter('node')) { | |
$node = $node->getTranslation('en'); | |
$title = $node->label(); | |
$title = str_replace(' ', '-', $title); | |
$title = str_replace('_', '-', $title); | |
$variables['title_en'] = strtolower($title); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="copyright">© {{ 'now'|date('Y') }} Dejan • All rights reserved</span> |
NewerOlder