Because panelizer uses the admin theme for node/*/*/panelizer -- when adding a panelizer issue to the queue on drupal.org, it shows the admin theme.

How to reproduce?
* Create a panelizer issue

Not exactly sure how to fix this yet. Appears to be an issue with how drupal.org's project module works. I'm gonna guess that any other module project that appends its admin UI to a node would see a similar issue if it defines an admin theme.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

japerry created an issue. See original summary.

neclimdul’s picture

japerry’s picture

I believe this isn't a panelizer issue. Project module shouldn't be adding additional url paths, because modules assume node/*/*/(project) is for node/edit/534534/(project)

japerry’s picture

Title: Panelizer shows admin theme on drupal.org » Project places a project in the URL instead of a parameter for node/add
Project: Panelizer » Project
Version: 7.x-3.x-dev » 7.x-2.x-dev
Component: Code » Projects
Priority: Critical » Major
DamienMcKenna’s picture

There must be a permission thing here, the problem doesn't happen for me.

drumm’s picture

Yep, view/access admin theme is a separate permission.

I'm not aware of a precedent for additional things being added to the node/add path as being particularly good or bad.

If we do change this to a query parameter, redirects must also be added.

DamienMcKenna’s picture

Panelizer matches the following path for the admin path:

  $items[$path . '/panelizer*'] = TRUE;

.. where $path is the entity path with all arguments converted to stars, therefore it would be node/*/panelizer* and not node/*/*/panelizer as suggested. Would that still trigger the match?

drumm’s picture

Priority: Major » Minor

node/*/panelizer* is indeed what it uses, and panelizer does take over node/{nid}/panelizer.

I expect this reaches drupal_match_path(), which I think secretly supports regular expressions. node/[0-9]+/panelizer* may work. That's non-ideal since it is exploiting secret functionality, and maybe Panelizer can't assume entities have numeric IDs in URLs. I can't think of another way to be more specific about which paths are admin paths.

DamienMcKenna’s picture

Project: Project » Panelizer
Component: Projects » Code

Sounds like this needs to go back to being a Panelizer issue then.

So it boils down to adding a hook_admin_paths() callback for the PanelizerEntityNode class and using a string that drupal_match_path() will accept.

DamienMcKenna’s picture

FileSize
801 bytes

Something like this might work.

DamienMcKenna’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 10: panelizer-n2627618-10.patch, failed testing.

neclimdul’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs work » Needs review

Branch didn't get switched back.

  • DamienMcKenna committed d643b0c on 7.x-3.x authored by drumm
    Issue #2627618 by drumm, DamienMcKenna: Override hook_admin_paths() for...
DamienMcKenna’s picture

Status: Needs review » Fixed
Parent issue: » #2787147: Plan for Panelizer 7.x-3.5 release

Committed. Thanks drumm for the regex suggestion.

DamienMcKenna’s picture

Status: Fixed » Needs review
FileSize
1.61 KB

Darnit. I should have added tests first.

DamienMcKenna’s picture

Rolling back the change.

The last submitted patch, 16: panelizer-n2627618-16.patch, failed testing.

DamienMcKenna’s picture

The regex doesn't work because drupal_match_path() runs preg_quote() on the string, breaking the fancy regular expression.

Darnit.

DamienMcKenna’s picture

DamienMcKenna’s picture

Status: Needs review » Needs work

I've committed the changes above.

Should maybe d.o add this to a custom module?

public function hook_admin_paths() {
  $items['node/add/project-issue/panelizer'] = FALSE;
  return $items;
}

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
714 bytes

Maybe it just needs to check the node_admin_theme setting?

DamienMcKenna’s picture

@drumm: What is node_admin_theme set to on d.o?

drumm’s picture

node_admin_theme is 0

DamienMcKenna’s picture

Ah! That explains it then.

This should cover it.

Status: Needs review » Needs work

The last submitted patch, 26: panelizer-n2627618-26.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
4.33 KB

Fixed the tests.

DamienMcKenna’s picture

Status: Needs review » Fixed

Ok. This works. Thanks all.

  • DamienMcKenna committed 63584b5 on 7.x-3.x
    Issue #2627618 by DamienMcKenna, drumm: Override hook_admin_paths() for...

Status: Fixed » Closed (fixed)

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