We need an update hook to support page manager in 8.3
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | page_manager-panels-update-2867565-11.patch | 2.37 KB | berdir |
We need an update hook to support page manager in 8.3
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | page_manager-panels-update-2867565-11.patch | 2.37 KB | berdir |
Comments
Comment #3
berdirif ($variant_plugin->getPluginId() === 'panels_variant') {
How is it page_manager's problem to fix panels variant plugins?
Comment #4
eclipsegc commentedBecause panels isn't aware (and shouldn't be) of PageManager's schema, so PageManager must parse its own schema and delegate to panels for the very narrow scope which panels DOES know about. In short, PageManager owns the schema, not panels, so that's the reasoning.
Eclipse
Comment #5
nagy.balint commentedFor me this update hook fails with:
Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: [error]
The "onecol" plugin does not exist. in
Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line
52 of
core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Comment #6
andypostTo solve #5 I used to replace all "onecol" and similar layouts in config export with "layouts_onecol"
Comment #7
nagy.balint commentedSo if I understand correctly, the update hook committed here, should replace the layout ids in the active config.
So then the update hook is not bullet proof enough.
Or did I misunderstand?
Comment #8
nagy.balint commentedSeems the line that fails is
"$variant_plugin = $page_variant->getVariantPlugin();"
Comment #9
aspilicious commentedThis patch fails when using drush because it can't find the "panels_convert_plugin_ids_to_layout_discovery" function.
Can we include the needed file?
I managed to work around this by running update.php manually on dev, acceptance and production. (which is not so cool :) )
Comment #10
berdirWell, that might work for panels, but if I would have my own module providing plugins that are used in page_manager, then I wouldn't be able to add an update function to page manager. It's kinda wrong in both places. The fact that this calls a function in panels kind of proves that.
The function panels_convert_plugin_ids_to_layout_discovery() exists though, but you probably need panels 4.x-dev.
However, as others pointed out, this is also not working for me. I think this should not be a post update function but a normal update function that uses low-level config API to be able to change the raw values *without* going through the plugin.
Comment #11
berdirAh, the function doesn't work because it is in the .install file we, we have to explicitly load it.
This is working for me now.
Comment #12
karolus commented@berdir: I just applied the patch, and this is what my log is displaying, when attempting to add a context to a Panels Everywhere variant:
Location [Site Root]/admin/structure/page_manager/manage/test_page_layout/variant/test_page_layout-panels_everywhere_variant-0/contexts/add/entity%3Anode_type?_wrapper_format=drupal_ajax&ajax_form=1
Referrer
[Site Root]/admin/structure/page_manager/manage/test_page_layout/page_variant__test_page_layout-panels_everywhere_variant-0__contexts?js=nojs
Message
Drupal\Component\Plugin\Exception\ContextException: The 'entity:node_type' context is required and not present. in Drupal\Core\Plugin\Context\Context->getContextValue() (line 71 of /[Site Root]/core/lib/Drupal/Core/Plugin/Context/Context.php).
Edit: Reinstalled the module, ran the patch. This is the message I get:
Warning: Missing argument 1 for Drupal\page_manager_ui\Form\PageVariantContextsForm::getContextClass(), called in /Users/karolus/Sites/kkonlined8/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php on line 35 and defined in Drupal\page_manager_ui\Form\PageVariantContextsForm->getContextClass() (line 54 of /Users/karolus/Sites/kkonlined8/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php) #0 /Users/karolus/Sites/kkonlined8/core/includes/bootstrap.inc(552): _drupal_error_handler_real(2, 'Missing argumen...', '/Users/karolus/...', 54, Array) #1 /Users/karolus/Sites/kkonlined8/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php(54): _drupal_error_handler(2, 'Missing argumen...', '/Users/karolus/...', 54, Array) #2 /Users/karolus/Sites/kkonlined8/modules/page_manager/page_manager_ui/src/Form/PageVariantContextsForm.php(35): Drupal\page_manager_ui\Form\PageVariantContextsForm->getContextClass() #3 [internal function]: Drupal\page_manager_ui\Form\PageVariantContextsForm->addContext(Array, Object(Drupal\Core\Form\FormState), Object(Symfony\Component\HttpFoundation\Request)) #4 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array(Array, Array) #5 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(98): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object(Symfony\Component\HttpFoundation\Request), Array, Object(Drupal\Core\Form\FormState), Array) #6 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #7 /Users/karolus/Sites/kkonlined8/vendor/symfony/http-kernel/HttpKernel.php(221): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent)) #8 /Users/karolus/Sites/kkonlined8/vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\Component\HttpKernel\HttpKernel->handleException(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1) #9 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #10 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /Users/karolus/Sites/kkonlined8/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /Users/karolus/Sites/kkonlined8/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /Users/karolus/Sites/kkonlined8/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /Users/karolus/Sites/kkonlined8/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /Users/karolus/Sites/kkonlined8/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #18 {main}.
Comment #13
berdirThis patch is about the upgrade path from 8.2, has nothing to do with your problem.
Comment #14
stefan.r commented#11 fixes the issue for us
Comment #15
rutiolmaconfirmed, everything looks good with #11
Comment #17
japerry#11 worked well for me. Committed.