Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've had this issue with both the 8.x-4.x and 8.x-1.x versions of Page Manager.
I can go through the UI, and select a context for use of a page variant, but cannot save. Basically, the save button is unresponsive. In checking the console logs, this is what I see:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/page_manager/manage/test_page_3/variant/test_page_3-panels_variant-0/contexts/add/entity%3Anode_type?ajax_form=1
StatusText: Internal Server Error
ResponseText: {}
Below is a screen grab of what I see when this fires:
Comment | File | Size | Author |
---|---|---|---|
Unable_to_select_variant_context.png | 226.15 KB | karolus |
Comments
Comment #2
karolus CreditAttribution: karolus as a volunteer commentedTurned on error logging on my build, and this is the result I'm getting:
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 /[my site install]/core/lib/Drupal/Core/Plugin/Context/Context.php).
Comment #3
bryanmws CreditAttribution: bryanmws commentedI'am having the same issue when I try saving an added FIELD context.
Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\ContextException: "The 'entity:field_config' context is required and not present." @ core/lib/Drupal/Core/Plugin/Context/Context.php line 71
Any1 having the same issue and a working solution?
Comment #4
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedI had the same issue and found this is related to Page manager contexts ajax broken callbackMy bad, I got this error too after applying the patch in the link
Comment #5
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedI checked it a bit more and found that the error is cause because Page Manager uses 'entity:node_type' as ID for the context. However, ctools expects contexts starting with 'entity:' to be an actual entity instance instead of a type.
It is some design issue here but I don't have enough insight on this to help further.
Note:
If you just want to add the node_type (e.g. article) as a context variable to be used by a custom module then you can select String in the select control and set a custom value for this purpose.
Comment #6
karolus CreditAttribution: karolus as a volunteer commented@piggito So, this may be a feature request, then, and not a bug?
BTW, how did you find out about how the error was occurring?
Comment #7
piggito CreditAttribution: piggito as a volunteer and at Skilld commented@karolus I do think it is a bug because the module is not correctly integrating with ctools for this case.
I found the cause by debugging the module and comparing with other contexts which work OK.
Comment #8
kashandarash CreditAttribution: kashandarash at AnyforSoft, Drupal Ukraine Community commentedComment #9
kashandarash CreditAttribution: kashandarash at AnyforSoft, Drupal Ukraine Community commentedComment #10
karolus CreditAttribution: karolus as a volunteer commented@piggito, thanks for the alternative solutions. As for your reply above:
How is this accomplished? I tried a few things, but so far, not working.
Comment #11
dcam CreditAttribution: dcam commentedI'm leaving this open so people will know what's going on, but this isn't a bug with Page Manager. Like @piggito said in #5, it's a bug with CTools. See the parent issue.
Comment #12
karolus CreditAttribution: karolus as a volunteer commented@dcam I can confirm that--with the patch to the linked CTools issue, the site is working as it should. Test environment: Drupal 8.5.0 running PHP 7.0.
Comment #13
mqannehI'm having the same issue.
Comment #14
edurenye CreditAttribution: edurenye at Digitalist commentedThe patch from https://www.drupal.org/project/ctools/issues/2696819 allows me to add the context, but when I hit 'Update and save' it fails and gives the following error:
Drupal\Core\Config\UnsupportedDataTypeConfigException: Invalid data type for config element page_manager.page_variant.test_page-panels_variant-0:static_context.path.value in Drupal\Core\Config\StorableConfigBase->castValue() (line 213 of core/lib/Drupal/Core/Config/StorableConfigBase.php).