ws_small_y-1.0.x-dev/ws_small_y.module

ws_small_y.module
<?php

/**
 * @file
 * Primary module hooks for YMCA Website Services - Small Y module.
 */

/**
 * Implements hook_theme().
 */
function ws_small_y_theme($existing, $type, $theme, $path) {
  return [
    'ws_header' => [
      'template' => 'small-y-header',
    ],
    'ws_footer' => [
      'template' => 'small-y-footer',
    ],
  ];
}

/**
 * Implements hook_block_alter().
 */
function ws_small_y_block_alter(&$definitions) {
  foreach ($definitions as $id => $definition) {
    if ($id === 'ws_site_logo') {
      $definitions[$id]['class'] = 'Drupal\ws_small_y\Plugin\Block\SmallYSiteLogoBlock';
    }
  }
}

/**
 * Implements hook_preprocess_HOOK().
 */
function ws_small_y_preprocess_ws_footer(&$variables) {
  $variables['#attached']['library'][] = 'ws_small_y/footer';
}

/**
 * Implements hook_preprocess_HOOK().
 */
function ws_small_y_preprocess_ws_header(&$variables) {
  $variables['#attached']['library'][] = 'ws_small_y/header';
}

/**
 * Implements hook_preprocess_HOOK().
 */
function ws_small_y_preprocess_ws_camp_header(&$variables) {
  $variables['#attached']['library'][] = 'ws_small_y/header';
}

/**
 * Implements hook_theme_registry_alter().
 */
function ws_small_y_theme_registry_alter(&$theme_registry) {
  $path = 'modules/contrib/ws_small_y';
  $override_components = [
    'block__ws_search_bar',
    'menu__extras',
    'menu__main',
  ];
  foreach ($override_components as $component) {
    if (isset($theme_registry[$component])) {
      $theme_registry[$component]['theme path'] = $path;
      $theme_registry[$component]['path'] = $path . '/templates';
    }
  }
}

/**
 * Implements hook_entity_type_alter().
 */
function ws_small_y_entity_type_alter(array &$entity_types) {
  if (isset($entity_types['menu_link_content'])) {
    $entity_types['menu_link_content']->addConstraint('WsMenuItemOverLimit');
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc