Unless I'm mistaken the only way for the Panelizer Defaults select list to appear on a node edit form is for the "administer panelizer" permission to be selected -- which is the broadest permission possible and allows the content editor to do everything on every content type.

It seems like an obvious use-case for the Panelizer Defaults is to allow a content editor to select one of a few pre-created layouts, not to go to the Panelizer page and modify Settings, Context, Layout or Content or even to use the IPE.

I would love to allow my content editors to switch layouts without being able to see all the confusing parts of Panelizer or to have a Panelizer tab on the node form.

thanks!

Comments

merlinofchaos’s picture

Status: Active » Fixed

I believe you want this permission:

      if (!empty($settings['choice'])) {
        $items["administer panelizer $this->entity_type $bundle choice"] = array(
          'title' => t('%entity_name %bundle_name: Choose panels', array(
            '%entity_name' => $entity_info['label'],
            '%bundle_name' => $entity_info['bundles'][$bundle]['label'],
          )),
          'description' => t('Allows the user to choose which default panel the entity uses.'),
        );
      }

Access to it is controlled like this:

      $form['panelizer'] = array(
        '#type' => 'fieldset',
        '#access' => $this->panelizer_access('choice', $entity, $view_mode),
        '#title' => t('Panelizer'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#group' => 'additional_settings',
        '#attributes' => array(
          'class' => array('panelizer-entity-options'),
        ),
        '#attached' => array(
          'js' => array(ctools_attach_js('panelizer-vertical-tabs', 'panelizer')),
        ),
        '#weight' => -10,
        '#tree' => TRUE,
      ) + $widgets;

That panelizer_access checks the master administer as well as the 'choice' one I linked above.

damienmckenna’s picture

@tchopshop: merlinofchaos' slightly verbose message means that this is already possible, there's a permission that will show once the feature is enabled that will be named named "[entity-type] [bundle]: Choice panels", e.g. "node article: Choice panels". You have to enable the "choice" option for the specific entity/bundle and then go to the admin/people/permissions page in order for the permission to show up.

tchopshop’s picture

Ah thank you so much, I was wondering if this was a patch or a module -- I was waiting on someone more technical to decipher it for me!

tchopshop’s picture

I'm sorry... I spoke too soon. Maybe I'm still not understanding. I actually do have "allow panel choice" checked on the node edit page.

However, I'm not seeing a new permission. For each content type/bundle I only see:

  • Administer Panelizer default panels, allowed content and settings
  • Administer Panelizer overview
  • Administer Panelizer settings
  • Administer Panelizer context
  • Administer Panelizer layout
  • Administer Panelizer content
  • Administer Panelizer breadcrumbs

I would have assumed the first one "Administer Panelizer default panels, allowed content and settings" would work to show the default panels, but it's not showing up with that permission, only with the overall panelizer permission.

grndlvl’s picture

Status: Fixed » Needs review
StatusFileSize
new1.57 KB

I think that maybe this was not updated when view modes support was added?

Here is my first crack at it to allow for $settings['view modes']['choice']. We may need to support the $settings['choice'] still as well?

merlinofchaos’s picture

Oh good grief, I can't believe I missed that.

Thanks grndlvl, you're absolutely correct.

tchopshop, try this patch.

tchopshop’s picture

Thank you so much! The defaults choice permission is showing up and the dropdown shows up on the node edit form.

briand44’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #5 fixed this issue for me.

smurrayatwork’s picture

The patch in #5 fixed this issue for myself as well. It should be noted though that the settings array will be overridden once the foreach loop finishes. Might be better to make a unique variable name there. Something like:

foreach ($settings['view modes'] as $view_mode => $view_mode_settings) {
+        if (!empty($view_mode_settings['choice'])) {
...
grndlvl’s picture

Good catch smurrayatwork.

Here it is again with the suggested change from #9.

sgurlt’s picture

#10 Works greate for me, thanks for the patch!

damienmckenna’s picture

+1.

damienmckenna’s picture

Title: Permission to change Panelizer Defaults on Node Edit Form » Permission to select Panelizer default on entity edit form
codycraven’s picture

Also confirming the patch works.

damienmckenna’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

I used my comaintainer Ace card and decided to commit this - excellent work, grndlvl!

tchopshop’s picture

Thank you everyone!!!

Status: Fixed » Closed (fixed)

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