outlayer-8.x-1.4/outlayer.module
outlayer.module
<?php
/**
* @file
* Provides Outlayer integration.
*/
use Drupal\outlayer\OutlayerDefault;
/**
* Provides a convenient shortcut for procedural hooks.
*
* @return \Drupal\outlayer\OutlayerManagerInterface
* |\Drupal\outlayer\OutlayerHookInterface
* The Outlayer class instances.
*/
// @codingStandardsIgnoreStart
function outlayer($key = 'manager') {
static $manager;
static $hook;
if (!isset($manager)) {
$manager = \Drupal::service('outlayer.manager');
$hook = \Drupal::service('outlayer.hook');
}
switch ($key) {
case 'hook':
return $hook;
default:
return $manager;
}
}
// @codingStandardsIgnoreEnd
/**
* Implements hook_theme().
*/
function outlayer_theme() {
return [
'gridstack__outlayer' => [
'render element' => 'element',
'base hook' => 'gridstack',
],
];
}
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function outlayer_theme_suggestions_gridstack_alter(array &$suggestions, array $variables, $hook) {
$settings = $variables['element']['#settings'];
if (!empty($settings['outlayer'])) {
$suggestions[] = 'gridstack__outlayer';
}
}
/**
* Implements hook_library_info_alter().
*/
function outlayer_library_info_alter(&$libraries, $extension) {
/* @phpstan-ignore-next-line */
outlayer('hook')->libraryInfoAlter($libraries, $extension);
}
/**
* Implements hook_library_info_build().
*/
function outlayer_library_info_build() {
/* @phpstan-ignore-next-line */
return outlayer('hook')->libraryInfoBuild();
}
/**
* Implements hook_config_schema_info_alter().
*/
function outlayer_config_schema_info_alter(array &$definitions) {
/* @phpstan-ignore-next-line */
outlayer('hook')->configSchemaInfoAlter($definitions, 'outlayer_base', OutlayerDefault::extendedSettings());
}
