...
 
Commits (2)
<?php
use Drupal\views\ViewExecutable;
use Drupal\node\Entity\Node;
/**
* Implements hook_views_pre_render().
......@@ -15,9 +14,16 @@ function radon_default_product_views_pre_render(ViewExecutable $view) {
/**
* Implements hook_page_attachments().
*/
function radon_default_product_page_attachments(array &$page) {
function radon_default_product_page_attachments(array &$attachments) {
$commerce_product = \Drupal::routeMatch()->getParameter('commerce_product');
$active_theme = \Drupal::theme()->getActiveTheme()->getName();
$admin_theme = \Drupal::config('system.theme')->get('admin');
if ($active_theme == $admin_theme) {
return;
}
if ($commerce_product) {
$page['#attached']['library'][] = 'radon_default_product/catalog-commerce-styles';
$attachments['#attached']['library'][] = 'radon_default_product/catalog-commerce-styles';
}
}