For the sake of this example, do the following:
- Add this to your theme.info.yml. There are alter hooks that can change this, and for that matter, we could just set these to
true
and load the paths some other way.
resources:
pattern-lab: /themes/custom/phase2/pattern-lab/public/
sassdoc: /themes/custom/phase2/dest/sassdoc/
- Add some module code like so:
<?php
/**
* @file
* Module code for the Now You See Me module.
*/
use \Drupal\Core\Url;
/**
* Implements hook_system_themes_page_alter().
*/
function phase2_views_idea_system_themes_page_alter($theme_groups) {
foreach ($theme_groups['installed'] as $theme) {
if (isset($theme->info['resources']['pattern-lab'])) {
$theme->operations[] = [
'title' => t('Pattern-lab'),
'url' => Url::fromUri('base:' . $theme->info['resources']['pattern-lab']),
'attributes' => ['title' => t('Pattern-lab for @theme theme', ['@theme' => $theme->info['name']])],
];
}
if (isset($theme->info['resources']['sassdoc'])) {
$theme->operations[] = [
'title' => t('Sassdoc'),
'url' => Url::fromUri('base:' . $theme->info['resources']['sassdoc']),
'attributes' => ['title' => t('Sassdoc for @theme theme', ['@theme' => $theme->info['name']])],
];
}
}
- See Screenshot.