Currently, the IPE is loading the context for the AJAX route that's rendering the block -- instead it should load the context for page the block is ultimately added to.

To reproduce:

  • Edit the /node/{node} page in Page Manager, and add a Panels variant which uses the IPE
  • Visit any node page
  • Try to place an "Entity view (Content)" block (in the CTools category)
  • If you open the web developer tools and look at what was returned via AJAX, it's: {"message":"A fatal error occurred: Required contexts without a value: entity."}

Issue fork panels-2636472

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dsnopek created an issue. See original summary.

dsnopek’s picture

Issue summary: View changes

Added steps to reproduce from #2665332: IPE not saving context mapping (and trying to map contexts too early) because the fix there doesn't fully fix the Page Manager case due to this issue.

legolasbo’s picture

I've been looking at this from different angles. Unfortunately I can only come up with two ways to determine the page to which the block should be added:

  1. Access the referrer header on the request object
  2. Pass the current page URL as a query argument to every AJAX call.

Both of these feel like a hack. I'll think about this some more later.

japerry’s picture

mlhess’s picture

Issue tags: +MWDS2016
samuel.mortenson’s picture

japerry’s picture

damienmckenna’s picture

Anyone have further insights?

damienmckenna’s picture

damienmckenna’s picture

damienmckenna’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev
berliner’s picture

This feels like a higher priority to me.
As for @legolasbo suggestions I'd probably go with the second option to keep this stateless.

I would love to help out with this, but I'm still getting accustomed to how Drupal 8 works, so I won't be of much help for the next weeks.

berliner’s picture

StatusFileSize
new4.93 KB

Ok, so I played a bit with this and came up with a patch that at least seems to work for me.

This is intended as a start and I assume that it's not the best implementation, happy to get feedback to improve this patch.

berliner’s picture

Status: Active » Needs review
berliner’s picture

StatusFileSize
new5.18 KB

Found another issue in my current test case that made this fail when context values are extracted from the path.
Attached patch fixes it for me.

berliner’s picture

StatusFileSize
new5.79 KB
new1.17 KB

Another thing I have run into, is that for IPE forms that are altered and enhanced with additional AJAX functionality (custom block implementation using more complex multi-step-style workflows for configuration), the global contexts are not correctly populated when the form is finally submitted. Might be that I miss something when it comes to Drupal 8 form processing, but reloading the full panels displays fixes the issue for me.

joseph.olstad’s picture

Triggered tests .

Hoping to find a fix for head failures relating to IPE
#3383474: Fix HEAD test failures for 4.x

joseph.olstad’s picture

StatusFileSize
new5.82 KB

Uploading a new file, the d.o test runner is being very picky right now.

straight up reroll, no change

Status: Needs review » Needs work

The last submitted patch, 18: 2636472_no_fuzz-18.patch, failed testing. View results

joseph.olstad’s picture

Status: Needs work » Needs review

The single failure has nothing to do with the patch, there's a single fail on HEAD.

joseph.olstad’s picture

Patch #16 is good, lets go

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

RTBC number 16

joseph.olstad’s picture

Liam Morland made their first commit to this issue’s fork.

liam morland’s picture

Re-rolled patch 16 and put into merge request.

liam morland’s picture

joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

I will close this as fixed. Thank you for the last patch @berliner and all others who were involved and care about IPE

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.