Problem/Motivation

PanelizerWizardContextForm calls the parent constructor like so:

    parent::__construct($typed_data_manager, $form_builder);

However, as of CTools 3.1, the parent constructor requires a third argument:

  public function __construct(TypedDataManagerInterface $typed_data_manager, FormBuilderInterface $form_builder, TypedDataResolver $ctools_typed_data_resolver) { ... }

Therefore, Panelizer is pretty broken on CTools 3.1. :(

Proposed resolution

Fix the constructor call, and require at least CTools 3.1.

Remaining tasks

Patch it.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Status: Active » Needs review
StatusFileSize
new2.14 KB

Status: Needs review » Needs work

The last submitted patch, 2: 3031671-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

hyperlinked’s picture

I second this and I was about to post the same issue with a nearly identical patch. The only difference between the way I patched it and and the way @phenaproxima did was that I made the TypedDataResolver the fourth argument instead of the third of the __construct() operation. The only reason I bring this up is that I'm interested in knowing if there's a best practice for how to add a new argument in cases like this.

I added it as the 4th argument just in case there was something extending the PanelizerWizardContextForm class and was providing the SharedTempStoreFactory object as the third argument, the change wouldn't break anything.

There isn't anything in the contrib codebase that I know of that is extending PanelizerWizardContextForm so this is just an academic question.

phenaproxima’s picture

The only reason I bring this up is that I'm interested in knowing if there's a best practice for how to add a new argument in cases like this.

I don't know there's any "official" best practice, but your way is better from a backwards compatibility standpoint. :)

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new4.55 KB
new3.34 KB

I think we also need to update all tempstores to Drupal\Core\TempStore\SharedTempStoreFactory. So this does that...

Status: Needs review » Needs work

The last submitted patch, 6: 3031671-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

malmeida287’s picture

Status: Needs work » Needs review
StatusFileSize
new5.12 KB
new470 bytes

Hi all,

Adding Drupal\Core\TempStore\SharedTempStoreFactory correction on file src/Plugin/PanelsPattern/PanelizerPattern.php to the patch.

Corrects error:

 Fatal error: Declaration of Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern::getDefaultContexts(Drupal\user\SharedTempStoreFactory $tempstore, $tempstore_id, $machine_name) must be compatible with Drupal\panels\Plugin\PanelsPattern\DefaultPattern::getDefaultContexts(Drupal\Core\TempStore\SharedTempStoreFactory $tempstore, $tempstore_id, $machine_name) in /home/vagrant/code/nos-medicos-do-mundo/site/web/modules/contrib/panelizer/src/Plugin/PanelsPattern/PanelizerPattern.php on line 14

on page /admin/structure/panelizer/edit/node_<node-type>_<view-mode>_<display>/content

Status: Needs review » Needs work

The last submitted patch, 8: 3031671-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Helrunar’s picture

#8 works for me

visantinian’s picture

#8 Fixed my issues

ivavictoria’s picture

Dropping by to confirm that patch #8 fixes the problem for me as well -- many thanks!!

ewaters5’s picture

#8 works for me also

ardnet’s picture

Hi,

I've implemented the patch, and I see that it seems solves the problem.
However, unfortunately, I've discovered another problem.

I couldn't save the Panel via IPE afterward, here's the error that I got from dblog:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of /Users/ardiiepl/Documents/Works/money-site_docker/money-site/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

The problem still persist even after I implemented this patch https://www.drupal.org/files/issues/2874489-12.patch from here: https://www.drupal.org/node/2874489

I haven't debug further again though.
I hope someone can shed me some light on this.

Thanks in advance!

kapil17’s picture

Priority: Major » Critical
Status: Needs work » Needs review
StatusFileSize
new3.99 KB

Hi,

I have Fixed this issue and created a patch. Please review.

Thanks

govind.maloo’s picture

Status: Needs review » Needs work

Patch is good but test is failing need to fix those before moving to further.

aniketto’s picture

Applying the patch in #15 fixes the issue of

Fatal error: Declaration of Drupal\panelizer\Plugin\PanelsPattern\PanelizerPattern::getDefaultContexts(Drupal\user\SharedTempStoreFactory $tempstore, $tempstore_id, $machine_name) must be compatible with Drupal\panels\Plugin\PanelsPattern\DefaultPattern::getDefaultContexts(Drupal\Core\TempStore\SharedTempStoreFactory $tempstore, $tempstore_id, $machine_name) in /var/www/xxxx/docroot/modules/contrib/panelizer/src/Plugin/PanelsPattern/PanelizerPattern.php on line 14

However accessing /admin/structure/panelizer/edit/node__landing_page__default__default/content?js=nojs and trying to clicking on 「+ Add new block」or Edit buttons on existing items does nothing.
Checking console shows below Ajax error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /en/admin/structure/panels/panelizer.wizard/node__landing_page__default__default/select_block?region&destination=/en/admin/structure/panelizer/edit/node__landing_page__default__default/content%3Fjs%3Dnojs
StatusText: OK
ResponseText: 
Error: Call to a member function getPattern() on null in Drupal\panels\Controller\Panels-&gt;selectBlock() 
(line 112 of /var/www/XXX/docroot/modules/contrib/panels/src/Controller/Panels.php).
wylbur’s picture

StatusFileSize
new3.06 KB

There's a new version of Panelizer, 8.x-4.2, so I rerolled the patch to account for some changes in the new branch.

I made no changes to resolve the issues pointed out in #17.

ivnish’s picture

Status: Needs work » Needs review
phenaproxima’s picture

Status: Needs review » Needs work

I agree with #16; the patch needs to be passing tests before it's ready for review.

phenaproxima’s picture

Priority: Critical » Normal

Also, downgrading back to major. This is not a critical priority issue, since it does not cause a security hole or data loss.

lamp5’s picture

Status: Needs work » Needs review
StatusFileSize
new3.01 KB

@wylbur you attached twice $container->get('ctools.typed_data.resolver'), so your patch doesn't works.

lamp5’s picture

roam2345’s picture

Status: Needs review » Needs work

Patch fails to apply to latest dev-4.x

www-data@5ee2206ee8df:/app/docroot$ composer update
    1/1:	http://repo.packagist.org/p/provider-latest$a6ae7825ccea794fcd6456116d31e6a63f90fb2054255e091e24888f03eefadb.json
    Finished: success: 1, skipped: 0, failure: 0, total: 1
Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies (including require-dev)         
Package operations: 2 installs, 0 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/panelizer (dev-4.x 0ad3608): Cloning 0ad3608074 from cache
  - Applying patches for drupal/panelizer
    https://www.drupal.org/files/issues/2020-03-25/3031671-SharedTempStoreFactory-22.patch (Change panelizer store)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2020-03-25/3031671-SharedTempStoreFactory-22.patch
lamp5’s picture

Status: Needs work » Reviewed & tested by the community

For me this issue is resolved right now. Please check the latest version of module.

phenaproxima’s picture

Assigned: Unassigned » phenaproxima
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Tagging for a reroll.

phenaproxima’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new1.98 KB

Try this on for size.

phenaproxima’s picture

Assigned: phenaproxima » Unassigned

Oh, and un-assigning from myself.

japerry’s picture

Status: Needs review » Reviewed & tested by the community

lgtm

phenaproxima’s picture

Adjusting credit for commit.

  • phenaproxima committed 30bf8fd on 8.x-4.x
    Issue #3031671 by phenaproxima, malmeida287, lamp5, kapil17, wylbur,...
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x-4.x. Thanks for the help on this, everyone!

Status: Fixed » Closed (fixed)

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