nuvoleweb / ui_patterns

[NOTE] Development has moved to https://drupal.org/project/ui_patterns
https://drupal.org/project/ui_patterns
GNU General Public License v2.0
85 stars 56 forks source link

Pattern plugins are not discovered during site install when building from configuration #161

Open jordanpagewhite opened 6 years ago

jordanpagewhite commented 6 years ago

Steps to reproduce

  1. Create a pattern and an accompanying paragraph type that uses the pattern as a layout
  2. Export your configuration (we are particularly interested in the entity_view_display config file for your paragraph type, but you'll need the other config as well obviously) to the config/install directory of a custom module
  3. Try to rebuild your site (drush si or use the browser) using this config

You should receive an error like the following:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "pattern_header" plugin does not exist. in                                                                  [error]
/home/vagrant/docroot/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52
Stack trace:
#0 /home/vagrant/docroot/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(25): Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition(Array,
'pattern_header', true)
#1 /home/vagrant/docroot/web/core/modules/field_layout/src/Entity/FieldLayoutEntityDisplayTrait.php(27):
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('pattern_header')
#2 /home/vagrant/docroot/web/core/modules/field_layout/src/Entity/FieldLayoutEntityViewDisplay.php(21):
Drupal\field_layout\Entity\FieldLayoutEntityViewDisplay->getLayoutDefinition('pattern_header')
#3 /home/vagrant/docroot/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(157): Drupal\field_layout\Entity\FieldLayoutEntityViewDisplay->getDefaultRegion()
#4 /home/vagrant/docroot/web/core/modules/field_layout/src/Entity/FieldLayoutEntityDisplayTrait.php(107): Drupal\Core\Entity\EntityDisplayBase->init()
#5 /home/vagrant/docroot/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(143): Drupal\field_layout\Entity\FieldLayoutEntityViewDisplay->init()
#6 /home/vagrant/docroot/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(172): Drupal\Core\Entity\EntityDisplayBase->__construct(Array,
'entity_view_dis...')
#7 /home/vagrant/docroot/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(322): Drupal\Core\Entity\Entity\EntityViewDisplay->__construct(Array,
'entity_view_dis...')
#8 /home/vagrant/docroot/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(459): Drupal\Core\Entity\EntityStorageBase->mapFromStorageRecords(Array)
#9 /home/vagrant/docroot/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(434):
Drupal\Core\Config\Entity\ConfigEntityStorage->_doCreateFromStorageRecord(Array)
#10 /home/vagrant/docroot/web/core/lib/Drupal/Core/Config/ConfigInstaller.php(338): Drupal\Core\Config\Entity\ConfigEntityStorage->createFromStorageRecord(Array)
#11 /home/vagrant/docroot/web/modules/contrib/features/src/FeaturesConfigInstaller.php(106): Drupal\Core\Config\ConfigInstaller->createConfiguration('', Array)
#12 /home/vagrant/docroot/web/core/lib/Drupal/Core/Config/ConfigInstaller.php(145): Drupal\features\FeaturesConfigInstaller->createConfiguration('', Array)
#13 /home/vagrant/docroot/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(252): Drupal\Core\Config\ConfigInstaller->installDefaultConfig('module',
'')
#14 /home/vagrant/docroot/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)
#15 /home/vagrant/docroot/web/core/includes/install.core.inc(1812): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)
#16 /home/vagrant/docroot/web/core/includes/batch.inc(294): _install_module_batch('
', '', Array)
#17 /home/vagrant/docroot/web/core/includes/form.inc(875): _batch_process()
#18 /home/vagrant/docroot/web/core/includes/install.core.inc(633): batch_process(Object(Drupal\Core\Url), Object(Drupal\Core\Url))
#19 /home/vagrant/docroot/web/core/includes/install.core.inc(554): install_run_task(Array, Array)
#20 /home/vagrant/docroot/web/core/includes/install.core.inc(117): install_run_tasks(Array)
#21 /home/vagrant/docroot/vendor/drush/drush/includes/drush.inc(726): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#22 /home/vagrant/docroot/vendor/drush/drush/includes/drush.inc(711): drush_call_user_func_array('install_drupal', Array)
#23 /home/vagrant/docroot/vendor/drush/drush/commands/core/drupal/site_install.inc(82): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array)
#24 /home/vagrant/docroot/vendor/drush/drush/commands/core/site_install.drush.inc(255): drush_core_site_install_version('', Array)
#25 /home/vagrant/docroot/vendor/drush/drush/includes/command.inc(422): drush_core_site_install('')
#26 /home/vagrant/docroot/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#27 /home/vagrant/docroot/vendor/drush/drush/includes/command.inc(199): drush_command('')
#28 /home/vagrant/docroot/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#29 /home/vagrant/docroot/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#30 /home/vagrant/docroot/vendor/drush/drush/drush.php(12): drush_main()
#31 {main}
ademarco commented 6 years ago

Where is the header pattern declared exactly?

slucero commented 6 years ago

In this case the header pattern was being defined within the active theme. We were able to sidestep the issue by enabling DS and using that to manage the layout discovery and assignment instead.

ademarco commented 6 years ago

Interesting, so it happens when using field_layout, I'll try to reproduce, thanks!

JPustkuchen commented 5 years ago

Yes I can confirm this happens when using field_layout. We're NOT using ds and definitely don't want to use it.

hcpss-banderson commented 2 years ago

Came across the same problem. As a workaround, I moved the pattern definition from the theme to a module. That worked for me.