It would useful to allow view_content panes to allow pane settings to control what view fields are shown.

Comments

jonskulski’s picture

Status: Active » Needs review
StatusFileSize
new3.25 KB

Here is a possible approach.

joshk’s picture

+1 for this. It allows for a lot of useful flexibility within practical site-building. Without this, you end up building nearly identical views that show different sets of fields.

jonskulski’s picture

I'd also like to check if the view is using a fields enabled style_plugin, but at the point I need to check (building the pane setings form) the view isn't built enough to do a check like

$view->style_plugin->uses_fields()

If we run a $view->execute(), then we have enough information. I don't really like that solution and if we can avoid it, I would like to.

Do you have any advice for this check?

joshk’s picture

IMHO if this is for the views content pane administration, it's a rare operation so an "expensive" $view method call would be ok. There might be a better way though; I'm surprised we don't get this from the initial load though. Perhaps Merlin will appear and give us some guidance.

merlinofchaos’s picture

Hmm. The approach seems reasonable.

What about calling $view->init_style() to get the style plugin initialized? You're allowed to initialize that early if needed, though arguments will change it if they're using summary views. I don't think that's a huge deal at the point you need to check to display a list of fields.

jonskulski’s picture

StatusFileSize
new3.37 KB

Thanks merlin.

Rerolled.

jonskulski’s picture

StatusFileSize
new2.31 KB

Avoiding an invalid foreach error. If you added a views content pane, then turned on fields override without resubmitting the form then we would get the error.

sdboyer’s picture

Title: Allow view_content panes to override field settings for view » Allow view_content panes to selectively show/hide their view's fields
Status: Needs review » Fixed

This is indeed some nifty functionality, color me convinced. I have a nagging feeling I'm missing a small bug in here somewhere, but my basic tests indicate it to be stable enough that I feel OK committing it. So if there does turn out to be an oversight somewhere, we can deal with that when it they arises :)

Status: Fixed » Closed (fixed)

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