- Issue created by @pameeela
- π¦πΊAustralia pameeela
In keeping with my strategy of doing something wrong just to get it started.... as suggested by @tim.plunkett, we can achieve this visually by just setting the logo to empty. It still outputs the div and img tag as empty which I think we need to fix.
- πΊπΈUnited States chrisfromredfin Portland, Maine
I think it is more distracting to switch sources and have an inconsistent UI. I would prefer to leave a default logo there.
- πΊπΈUnited States chrisfromredfin Portland, Maine
This diff should get us toward a selector we can use to style per-source. Stuffing it here before I run off.
diff --git a/project_browser.module b/project_browser.module index a823a55..5fe7705 100644 --- a/project_browser.module +++ b/project_browser.module @@ -38,7 +38,7 @@ function project_browser_help($route_name, RouteMatchInterface $route_match) { function project_browser_theme() { return [ 'project_browser_main_app' => [ - 'variables' => [], + 'variables' => ['source_plugin' => NULL], ], ]; } @@ -59,3 +59,15 @@ function project_browser_project_browser_source_info_alter(array &$definitions): ]; } } +/** + * Implements template_preprocess_HOOK(). + * + * @param mixed $variables + * @return void + */ +function project_browser_preprocess_project_browser_main_app(&$variables) { + // Pass the current route's "source" parameter as the source_plugin var. + $route_match = \Drupal::service('current_route_match'); + $param = $route_match->getParameter('source') ?? NULL; + $variables['source_plugin'] = $param; +} diff --git a/templates/project-browser-main-app.html.twig b/templates/project-browser-main-app.html.twig index f3768f4..b94487a 100644 --- a/templates/project-browser-main-app.html.twig +++ b/templates/project-browser-main-app.html.twig @@ -11,4 +11,4 @@ </div> </div> -<div id="project-browser"></div> +<div id="project-browser" data-pb-source="{{ source_plugin|clean_class }}"></div>
See https://drupal.slack.com/archives/C01UHB4QG12/p1736163780116629