farmOS/modules/ui/theme/farm_ui_theme.module

59 lines
1.4 KiB
PHP

<?php
/**
* @file
* The farmOS UI Theme module.
*/
use Drupal\Core\Block\BlockPluginInterface;
/**
* Implements hook_element_info_alter().
*/
function farm_ui_theme_element_info_alter(array &$info) {
if (isset($info['farm_map'])) {
$info['farm_map']['#attached']['library'][] = 'farm_ui_theme/map';
}
}
/**
* Implements hook_preprocess_HOOK().
*/
function farm_ui_theme_preprocess_block(&$variables) {
if ($variables['plugin_id'] == 'help_block') {
$variables['#attached']['library'][] = 'farm_ui_theme/help';
}
}
/**
* Implements hook_preprocess_HOOK().
*/
function farm_ui_theme_preprocess_farm_map(&$variables) {
// We need to add the flag CSS to pages with maps in them because a user MAY
// click a popup which MAY have flags in it. Otherwise the flags do not get
// styled.
$variables['#attached']['library'] = 'farm_ui_theme/flag';
}
/**
* Implements hook_preprocess_HOOK().
*/
function farm_ui_theme_preprocess_toolbar(&$variables) {
$variables['#attached']['library'][] = 'farm_ui_theme/toolbar';
}
/**
* Implements hook_block_view_BASE_BLOCK_ID_alter().
*/
function farm_ui_theme_block_view_farm_powered_by_block_alter(array &$build, BlockPluginInterface $block) {
$build['#attached']['library'][] = 'farm_ui_theme/footer';
}
/**
* Implements hook_preprocess_HOOK().
*/
function farm_ui_theme_preprocess_field__flag(array &$variables) {
$variables['#attached']['library'][] = 'farm_ui_theme/flag';
}