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:

CommentFileSizeAuthor
Unable_to_select_variant_context.png226.15 KBkarolus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

karolus created an issue. See original summary.

karolus’s picture

Turned 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).

bryanmws’s picture

I'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?

piggito’s picture

I had the same issue and found this is related to Page manager contexts ajax broken callback
My bad, I got this error too after applying the patch in the link

piggito’s picture

I 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.

karolus’s picture

@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?

piggito’s picture

@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.

kashandarash’s picture

Assigned: Unassigned » kashandarash
kashandarash’s picture

Assigned: kashandarash » Unassigned
karolus’s picture

@piggito, thanks for the alternative solutions. As for your reply above:

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.

How is this accomplished? I tried a few things, but so far, not working.

dcam’s picture

Status: Active » Postponed
Parent issue: » #2696819: Cannot add contexts whose entity ids are not numeric

I'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.

karolus’s picture

@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.

mqanneh’s picture

I'm having the same issue.

edurenye’s picture

The 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).