It would be great if you could select which view mode a specific pane should use, a la the Bean module.

Comments

merlinofchaos’s picture

That shouldn't be too hard to implement.

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new2.87 KB

This supports view modes, and for existing panel panes, it assumes the view mode is 'full' when it isn't specified in the pane settings.

If you need a UI for adding more view modes, http://drupal.org/project/entity_view_mode is the simplest option. You can also implement this hook in a module.

/**
 * Implements hook_entity_info_alter().
 */
function MODULE_entity_info_alter(&$entity_info) {
  $entity_info['fieldable_panels_pane']['view modes']['small'] = array(
    'label' => t('Small'),
    'custom settings' => TRUE,
  );
}

View modes shouldn't be overextended. In the File entity module issue queue, some smart people have offered some guidance about when to extend view modes vs when to alter formatters. When I'm working with a fieldable panel pane that has only one field on it, I might prefer to just reconfigure the formatter for that field.

Nevertheless, here's a patch that I'm going to run with!

scottrigby’s picture

Status: Needs review » Reviewed & tested by the community

@bangpound - nice!

I just asked @merlinofchaos about this today in #drupal-panels (in the context of panopoly)… I just finished making a (slightly more elaborate) patch - was just about to upload it, only to find you beat me to it :)

I'm tempted not to fuss with this because it's simple and works

azinck’s picture

Patch looks good, I'll give it a try. Thanks bangpound!

scottrigby’s picture

quick thought - the only thing i might want to see on that patch is to weight the view_mode element so it's with the other configurations (closer to the reusable elements) out of the box

Anonymous’s picture

Just tell me a number and I'll re-roll the patch.

scottrigby’s picture

@bangpound I had #weight' => 10, because that's what $form['reusable'] was set to… but that was on a fieldset enclosing view_mode, in fieldable_panels_panes_entity_edit_form() :)

I think your way is better though. Maybe it makes sense above the reusable options - i'm running out otherwise would check it & reroll now… how about 9?

swentel’s picture

Status: Reviewed & tested by the community » Needs work

I think this one needs work, because you can not

a) change the view mode anymore
b) select the view mode of an existing entity in case you have created the entity first at admin/structure/panels/entity/manage/content-wide/add (custom bundle)

merlinofchaos’s picture

Status: Needs work » Fixed

I corrected for #8 -- a) is actually wrong, you can change the view mode during edit, but #2 was correct in that you couldn't set the view mode when adding a reusable pane. I adjusted the form to allow for this (it was kind of tricky so it was probably most efficient for me to do that). I committed and pushed. http://drupalcode.org/project/fieldable_panels_panes.git/commit/a9c0d001...

scottrigby’s picture

Awesome =)

Status: Fixed » Closed (fixed)

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

eloivaque’s picture

I have a same problem. If added a new panes on panalizer, in form of new panes, the field view mode allow select all view modes, still in manage display of the panels i selected 2 view modes.

I attach a patch to possibility solved.

eloivaque’s picture

Status: Closed (fixed) » Patch (to be ported)
xtfer’s picture

Status: Patch (to be ported) » Closed (fixed)

Eloiv, this is fixed. You should open a new issue.

drclaw’s picture

Issue summary: View changes

I don't believe Eliov ever created that new issue. Here's one with a patch that does a little extra when there's no view modes with custom settings: #2498623: Only show view modes with custom settings on FPP edit form