It appears #1820442: Panelizer for Comments introduced a bug where the path to 'admin/structure/types/manage/%/panelizer' is inaccessible. Users receive a 403 error (even user1). When the patch from comment #4 from #1820442: Panelizer for Comments is applied to 7.x-3.1, the bug described by this issue manifests itself.

The bug is also observable by upgrading to revision 'a75c0e5bb05d1cbb2bc9f3c06569fb2ebcea3c5c' (Issue #1820442 by dixon_: Panelized comments.)

Comments

damienmckenna’s picture

Status: Active » Postponed (maintainer needs more info)

Did you have the Comment module enabled? If not, please try downloading the latest -dev snapshot again.

chris burge’s picture

The Comment module is enabled. Disabling it has no effect.

I'm using a brand-new Drupal install (7.26) with the 'Standard' install profile. The issue persists in the '7.x-3.x' branch as of commit 104488cb91da2c28d03ae80aff46fc5978238650 (Issue #1965148 by DamienMcKenna, fago, das-peter: Don't save records for default...)

chris burge’s picture

Status: Postponed (maintainer needs more info) » Active
damienmckenna’s picture

I've just committed another fix for the comments integration, does it still happen?

Also, what user account are you using? User 1 or another one?

damienmckenna’s picture

Ok, scrap that, I reread your original request and you are using user 1. Drat.

chris burge’s picture

Commit 89c91da764f1824d5d3c7febd2f602eeab620aae doesn't appear to modify the behavior described by this issue.

The issue is related to the new 'PanelizerEntityComment' class. Line 13 in 'plugins/entity/PanelizerEntityComment.class.php' is of interest because this is the same path reported by this issue:

 7 /**
 8 * Panelizer Entity comment plugin class.
 9 *
10 * Handles comment specific functionality for Panelizer.
11 */
12 class PanelizerEntityComment extends PanelizerEntityDefault {
13   public $entity_admin_root = 'admin/structure/types/manage/%';
14   public $entity_admin_bundle = 4;
15   public $views_table = 'comment';
16   public $uses_page_manager = FALSE;
17
18   public function entity_access($op, $entity) {
19     if ($op == 'edit') {
20       return comment_access($op, $entity);
21     }
22     // The view operation is not implemented by core.
23     if ($op == 'view') {
24       return TRUE;
25     }
26
27     return FALSE;
28   }

When I modify line 13, the symptom described by this issue is no longer present; however, I don't know how resolve this issue in a way that doesn't break the new Comment functionality.

Line 17 from 'plugins/entity/PanelizerEntityNode.class.php' may be instructive:

17 public $entity_admin_root = 'admin/structure/types/manage/%panelizer_node_type';

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new652 bytes

Thanks for the sleuthing. Does this resolve the problem?

damienmckenna’s picture

Status: Needs review » Fixed

I've committed this, thanks for the sleuthing, Chris!

chris burge’s picture

Status: Fixed » Active
StatusFileSize
new11.05 KB

This issue remains unresolved. I don't believe line 13 is necessary:

plugins/entity/PanelizerEntityComment.class.php

13  public $entity_admin_root = 'admin/structure/types/manage/%panelizer_node_type';

I dug a little deeper into plugins/entity/PanelizerEntityDefault.class.php:

159  /**
160   * Base class for the Panelizer Entity plugin.
161   */
162  abstract class PanelizerEntityDefault implements PanelizerEntityInterface {
163    /**
164     * Where in the entity admin UI we should add Panelizer tabs with bundles.
165     */
166    public $entity_admin_root = NULL;

The Comments entity type doesn't have an admin UI where Panelizer tabs would be added, correct?

Further, when line 13 is included, there is undesired behavior:

  • The Panelizer tab on nodes is no longer available
    • e.g. admin/structure/types/manage/page
  • Export tab is missing from content type Panelizer default config page
    • See attached screenshot
    • e.g. admin/structure/types/manage/page/panelizer/default/%/settings
  • Duplicate sub-tabs on content type Panelizer default config page
    • See attached screenshot
    • e.g. admin/structure/types/manage/page/panelizer/default/%/settings
    • When clicked, duplicate sub-tabs result in invalid path and a 403 error
chris burge’s picture

Status: Active » Needs review
StatusFileSize
new587 bytes

Patch to remove '$entity_admin_root' from 'PanelizerEntityComment.class.php'

damienmckenna’s picture

A few things: have you enabled Panelizer for comments on any content types? Have you enabled Panelizer for any content types themselves? What version of PHP are you using?

damienmckenna’s picture

StatusFileSize
new1.25 KB

Out of interest, does this solve the problem?

damienmckenna’s picture

StatusFileSize
new589 bytes

I thought I'd uploaded this already, evidently not.

damienmckenna’s picture

FYI the patch in #13 just removes the $entity_admin_root and $entity_admin_bundle values completely.

chris burge’s picture

The patch from #12 doesn't appear to have an affect on the symptoms described by this issue. It does result in a new error, however:

Warning: str_replace() expects at least 3 parameters, 2 given in PanelizerEntityComment->add_admin_links() (line 88 of /var/aegir/platforms/cu_platform_2-x_5/sites/example.com/modules/panelizer/plugins/entity/PanelizerEntityComment.class.php).

The patch from #13 corrects the symptoms described by this issue.

damienmckenna’s picture

Are you saying that the patch in #13 resolves the main problem of the 'admin/structure/types/manage/%/panelizer' paths being inaccessible, or it just removes the 'str_replace' bug I left in #12?

damienmckenna’s picture

StatusFileSize
new1 KB

Updated to disable 'admin_paths' in commend.inc.

damienmckenna’s picture

Need to fix this.

chris burge’s picture

Regarding #16, I tested patch #12 and patch #13 independently. Should I be testing with both patches being applied successively (with patch #17 replacing #13)?

damienmckenna’s picture

Step #1: Download the latest -dev release.
Step #2: Apply patch #17.

Let me know how it goes. Thanks!

chris burge’s picture

I downloaded the latest dev release and applied patch #17. Testing was successful. Thanks.

damienmckenna’s picture

Status: Needs review » Fixed

Thanks for the help fixing this, Chris! I've committed the patch.

Status: Fixed » Closed (fixed)

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