-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathib3.theme
More file actions
37 lines (33 loc) · 1013 Bytes
/
ib3.theme
File metadata and controls
37 lines (33 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* @file
* Functions to support theming in the ib3 theme.
*/
function ib3_preprocess_breadcrumb(array &$variables)
{
if(($node = \Drupal::routeMatch()->getParameter('node')) && $variables['breadcrumb']){
$variables['breadcrumb'][] = array(
'text' => $node->getTitle()
);
}
}
function ib3_theme_suggestions_alter(array &$suggestions, array $variables, $hook)
{
if ($hook == 'form' & !empty($variables['element']['#id'])) {
$suggestions[] = 'form__' . str_replace('-', '_', $variables['element']['#id']);
}
}
function ib3_theme_suggestions_page_alter(array &$suggestions, array $variables, $hook)
{
if (!is_null(Drupal::requestStack()->getCurrentRequest()->attributes->get('exception'))) {
$status_code = Drupal::requestStack()->getCurrentRequest()->attributes->get('exception')->getStatusCode();
switch ($status_code) {
case 404: {
$suggestions[] = 'page__' . (string) $status_code;
break;
}
default:
break;
}
}
}