| Conditions | 5 |
| Paths | 9 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | function one_preprocess_block(&$variables) { |
||
| 13 | // Add the class container if layout builder is not used. |
||
| 14 | if (\Drupal::request()->attributes->get('node')) { |
||
| 15 | $nid = \Drupal::request()->attributes->get('node')->id(); |
||
| 16 | $node = \Drupal::entityTypeManager()->getStorage('node')->load($nid); |
||
| 17 | if (!$node->layout_builder__layout) { |
||
|
|
|||
| 18 | $variables['attributes']['class'][] = 'container'; |
||
| 19 | } |
||
| 20 | } |
||
| 21 | else { |
||
| 22 | $variables['attributes']['class'][] = 'container'; |
||
| 23 | } |
||
| 24 | |||
| 25 | |||
| 26 | if (isset($variables['elements']['#id'])) { |
||
| 27 | $region = Block::load($variables['elements']['#id'])->getRegion(); |
||
| 28 | // Pass block region value to content so this can be used |
||
| 29 | // in hook_theme_suggestions_menu_alter |
||
| 30 | $variables['content']['#attributes']['region'] = $region; |
||
| 31 | // Add the class col for all block in the footer. |
||
| 32 | if ($region == 'footer') { |
||
| 33 | $variables['attributes']['class'][] = 'col'; |
||
| 34 | } |
||
| 40 |