oliverdavies.uk/web/themes/custom/opdavies/opdavies.theme
Oliver Davies 3b6ad20486 Move padding from list items to links
So that the padding takes up the full space within the tab, move the
padding to the link element. This requires adding a preprocess function
to the theme file and removing the classes from the local task template.

References #341
2021-01-10 22:05:50 +00:00

34 lines
681 B
Text

<?php
/**
* @file
* Functions to support theming in the Tailwind CSS theme.
*/
use Drupal\opdavies_blog\Entity\Node\Post;
/**
* Implements hook_preprocess_HOOK().
*/
function opdavies_preprocess_page(array &$variables): void {
/** @var Post|null $node */
$node = $variables['node'] ?? NULL;
if (!$node) {
return;
}
if (!$node instanceof Post) {
return;
}
if ($node->hasTweet()) {
$variables['#attached']['library'][] = 'opdavies/twitter';
}
}
/**
* Implements hook_preprocess_HOOK().
*/
function opdavies_preprocess_menu_local_task(array &$variables): void {
$variables['link']['#options']['attributes']['class'][] = 'block px-5 py-2';
}