The View Mode selector is confusing for people when they're creating a new bean, might it be possible to hide it if only "Default" and "Token" are the only ones currently available? It might be worth hiding "Token" anyway, it doesn't make sense as a display option anyway.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

indytechcook’s picture

There is a permission that lets you hide it from users. 'edit bean view mode'

DamienMcKenna’s picture

Component: User interface » Documentation
Category: feature » task

Oh, cool, I'll work on a patch to the README.txt file to document this.

MrHaroldA’s picture

Maybe a silly question: what does it do? I mean, I don't have such a view mode selector on any other entity, yet they all support view modes?

Can't the selector be omitted in total?

Edit: Seconds after submitting my question I realize that this is the only way to set the view mode. Silly me.

brahimmouhamou’s picture

Issue summary: View changes

Wouldn't it be cool if you could select which view modes can be chosen by the content manager?
Because as mentioned above the 'Tokens' view mode is totally overrated most of the times but the CA.

On the 'Manage Display' page there is a section called 'Custom display settings' where you can enable your view modes so it would be nice if only this selection is available when choosing a view mode.

Is this possible now with Bean or another contrib module?

kyletaylored’s picture

Title: Option to hardcode/hide the View Mode selector » Select only from enabled view modes
Version: 7.x-1.0-rc10 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
27.7 KB
21.36 KB
31.44 KB
1.1 KB

This is something that's been bugging me for awhile, so I wrote a patch for it.

Problem
The list of view modes that can be selected don't reflect the view modes that are enabled for that specific Block Type, thus can cause confusing for end users selecting the view mode when creating new blocks.

Solution
Select only from the list of view modes that are enabled for that specific Block Type. If no options are enabled, then provide "Default" as a fallback - which is exactly what this patch does.

Before
Before BEAN view mode patch

After
After BEAN view mode patch

Enabled View Modes
Enabled View Modes

fengtan’s picture

Tested patch #5, seems to work well. As suggested by @Rimbah, the view modes need to be selected on the 'Manage Display' page, which looks nice.

DamienMcKenna’s picture

Status: Needs review » Needs work

There could be sites that depend upon being able to select from all available view modes, I'd suggest making it an option that can be disabled somewhere and maybe adding an update script to disable the option for existing sites. (we had a similar issue on Fieldable Panels Panes)

kyletaylored’s picture

If a view mode isn't enabled, then how can it be utilized to begin with? I just want to understand, because I've never seen that use case before and seems fairly niche. I feel like if that was the case, they might've not been using the module correctly from the start?

ozin’s picture

Status: Needs work » Needs review

Hi guys, I faced with the same issue and I think @kyletaylored is right. If u did not enable some view mode for the block it means u did not configured output for it so it means it should not be available on the block settings page. I think it make sense to show only enabled view modes.

Regarding update scripts, I think it is not needed here.

ozin’s picture

I think the "Default" view mode should be available always.