browser_development-8.x-1.x-dev/browser_development.module
browser_development.module
<?php
/**
* @file
* Contains browser development .
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function browser_development_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.browser_development':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Creates SCSS elements') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_module_implements_alter().
*/
function browser_development_module_implements_alter(&$implementations, $hook) {
if ($hook == 'page_attachments') {
$list = ['browser_development'];
\Drupal::moduleHandler()->invokeAllWith('browser_development', function (callable $hook, string $module) {
if (isset($implementations[$module])) {
$list[] = $module;
}
});
foreach ($list as $module_name) {
$group = $implementations[$module_name];
unset($implementations[$module_name]);
$implementations[$module_name] = $group;
}
}
}
/**
* Implements hook_page_attachments().
*/
function browser_development_page_attachments(array &$attachments) {
$current_path = \Drupal::service('path.current')->getPath();
$pos = strpos($current_path, 'admin/browser-development/editor');
if ($pos != NULL) {
$path_to_use = 'browser_development/browser-development';
$attachments['#attached']['library'][] = $path_to_use;
}
}
/**
* Implements hook_theme_suggestions_table_alter().
*
* @inherit
*/
function browser_development_theme_suggestions_table_alter(array &$suggestions, array &$variables, $hook) {
if (isset($variables['attributes']['id'])) {
$table_id = $variables['attributes']['id'];
$id = str_replace("-", "_", $table_id);
$suggestions[] = $hook . '__' . $id;
}
}
