Layouts are defined for patterns in the UI Patterns Layouts submodule's hook_layout_alter() implementation.
The $definition passed to LayoutDefinition constructor lacks an id property. Because of this, the resulting definition has an empty id. What is expected instead is that the id will be the same as the key used when creating the layout, which is in the form 'pattern_' . $pattern_id where $pattern_id is the ID of the pattern.
This bug is causing incompatibility with certain other modules that use the layout definition ID value. One example is the Styleguide module, which derives a styleguide entry for each layout using the following code:
Currently attempting to view a styleguide on a site with layouts provided by UI Patterns Layouts produces the following fatal error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist.
Steps to reproduce
Add one or more UI patterns to a site.
Install the UI Patterns Layouts submodule.
Run code like the following:
$definitions = \Drupal::service('plugin.manager.core.layout')->getGroupedDefinitions();
foreach ($definitions['Patterns'] as $definition) {
// Examine the return value of $definition->id().
}
Result: the value is empty.
Proposed fix
Pass an id value to the LayoutDefinition constructor.
Bug description
Layouts are defined for patterns in the UI Patterns Layouts submodule's
hook_layout_alter()
implementation.The
$definition
passed toLayoutDefinition
constructor lacks anid
property. Because of this, the resulting definition has an emptyid
. What is expected instead is that theid
will be the same as the key used when creating the layout, which is in the form'pattern_' . $pattern_id
where$pattern_id
is the ID of the pattern.This bug is causing incompatibility with certain other modules that use the layout definition ID value. One example is the Styleguide module, which derives a styleguide entry for each layout using the following code:
Currently attempting to view a styleguide on a site with layouts provided by UI Patterns Layouts produces the following fatal error:
Steps to reproduce
Run code like the following:
Result: the value is empty.
Proposed fix
Pass an
id
value to theLayoutDefinition
constructor.