component_connector-1.1.0/component_connector.module
component_connector.module
<?php
/**
* @file
* Primary module hooks for connector module.
*/
/**
* Implements hook_theme_registry_alter().
*/
function component_connector_theme_registry_alter(&$theme_registry) {
// Process components.
\Drupal::service('component_connector.manager')
->alterRegistry($theme_registry);
}
/**
* Implements hook_library_info_alter().
*/
function component_connector_library_info_alter(&$libraries, $extension) {
$active_theme = \Drupal::service('theme.manager')
->getActiveTheme()
->getName();
if ($extension == $active_theme) {
$new_libs = \Drupal::service('component_connector.manager')
->buildLibraries();
$libraries = array_merge($libraries, $new_libs);
}
}
/**
* Implements hook_layout_alter().
*/
function component_connector_layout_alter(&$definitions) {
// Process layouts.
\Drupal::service('component_connector.manager')->alterLayouts($definitions);
}
/**
* Implements hook_themes_installed().
*/
function component_connector_themes_installed($theme_list) {
// Init theme when it's installed to get layouts.
$theme = \Drupal::configFactory()
->get('component_connector.settings')
->get('theme');
if ($theme && in_array($theme, $theme_list)) {
\Drupal::service('theme.registry')->initDefault();
}
}
