Currently, if you add any "Content pane" View to page which uses Fields, Content or Table to display, it'll allow the user to switch between them.

However, it'd be great to be able to provide a way for certain Views to opt out of this functionality!

Ideally, I think this would be another checkbox in the "Allow settings" configuration on the View. But I'm not sure how easy/possible it is to alter that form and store our data there.

If that's not possible, it'd be great to have some kind of whitelist/blacklist in the Panopoly Magic configuration to say that certain widgets are for sure allowed and others aren't. Or at the very least a hook to make that determination!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsnopek’s picture

Assigned: Unassigned » dsnopek

It totally possible to get this on to the "Allow settings" form! That part was actually pretty easy. I've been having more trouble disabling the 'Display type' form element without breaking all sorts of other things, which I'm still working on...

Assigning to me because I'm working on this now!

dsnopek’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
7.56 KB

Ok, here is a patch that implements the functionality. Removing the 'Display type' form element was problematic because there are a bunch of form elements that depend on it via '#states'. I tried coming up with a way to only set '#states' conditionally if we were using 'Display type' but otherwise hide via '#access' but it turned into a big spaghetti mess that didn't really work. :-/

So, this patch takes a much simpler approach, which always puts 'Display type' on the form, but turns it into a 'hidden' input if we don't want to see it, so the '#states' stuff still works. However, this is a hack and not really ideal. In future we need to really untangle this code so we can do "the right way".

This also had the side-effect that the code to check if the 'Display settings' fieldset was empty and hiding it no longer worked (because it wasn't really empty, the elements where just #type => 'hidden' now). So, the patch fixes that logic as well!

This still needs tests...

dsnopek’s picture

Here is a new patch which adds a hook_update_N() function and a patch to panopoly_test which adds tests! This works for me locally - need to run on Travis-CI with the full test suite next.

EDIT: Here's the Travis-CI build: https://travis-ci.org/panopoly/panopoly/builds/58603108

cboyden’s picture

The test patch looks like it also moves tests into a subdirectory of features - is that going to be repeated for other tests?

dsnopek’s picture

@cboyden: Eventually, per #2334333: Reorganize Behat tests by feature and role! I snuck it in here because it was getting convoluted with all the different .feature files that related to panopoly_magic.

cboyden’s picture

FileSize
56.37 KB

Looks like the patch to panopoly_test needs a re-roll. Attached.

cboyden’s picture

Status: Needs review » Reviewed & tested by the community

This is looking good. I think the default handling of column headers on table displays (i.e. always showing headers if they're present in the view) is what we want, but there may be some other opinions.

  • dsnopek committed 0214b5a on 7.x-1.x
    Update Panopoly Magic and Test for Issue #2468371 by dsnopek, cboyden:...
dsnopek’s picture

Status: Reviewed & tested by the community » Fixed

Awesome, thanks! Committed. We can address the header configuration in a follow-up if necessary.

Status: Fixed » Closed (fixed)

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