Open vever001 opened 4 years ago
There is something else going on here.
$return['path'] = str_replace($this->root, '', $definition->getBasePath());
The str_replace()
produces a path with leading slash.
E.g.
$definition_base_path = '/var/www/html/web/modules/custom/my_patterns/templates/patterns/my_pattern';
$root = '/var/www/html/web';
$path = str_replace($root, '', $definition_base_path);
print $path === '/modules/custom/my_patterns/templates/patterns/my_pattern' ? 'problem' : 'ok';
(I assume it is normal that $root
won't have a trailing slash)
I wonder why this is not more wildly occuring.
@vever001 From looking at the code, I don't think your PR would fix this..
Moved to drupal.org : https://www.drupal.org/project/ui_patterns/issues/3315219
If we are on the admin theme, and we have pattern definitions inside another theme (e.g: your main theme), then the
path
inhook_theme()
definitions are not correct. This is becauseLibraryPattern::processCustomThemeHookProperty
only takes into account modules.This breaks for example the preview when we are in the Views admin and other patterns usages when the active theme is not the one that contains the definitions. I will create a PR shortly.