This patch adds checkbox to the entity_from_field relationship form to reverse field items, allowing the highest delta to be selected. This is similar to how views 3 handles multiple value fields.

This patch may also begin to help with http://drupal.org/node/1420446 although it does not provide display settings for the field at all.

Note: I had to add a submit handler for the ctools_entity_from_field_edit_form - there is probably a better way to save the new value but I could not find the appropriate submit handler.

CommentFileSizeAuthor
entity_from_field.inc_.patch2.16 KBjohnnybgoode
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

uripo’s picture

I applied your patch, but I don't see any checkbox in the Views relationships dialog.

Is it maybe I missed something I'm supposed to do after applying the patch?
Or... perhaps I misunderstood something and so I'm looking in the wrong place?

johnnybgoode’s picture

This patch has nothing to do with Views or views relationships, it only provides functionality similar to how Views handles multiple value fields.

This patch will add a checkbox to the settings form for an 'entity from field' relationship in the panels page manager to allow the entities referenced by the possibly multiple value field to be reversed when returned to panels as contexts. This then allows the user to easily select the last entity referenced by a multiple value field, e.g. the deepest taxonomy term selected in a term reference field.

Hope that clears things up.

jonhattan’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

Works as expected.

I guess we need a 8.x version first btw.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Needs work

The patch fails code style:

if ($foo) { ... }

That's simple enough to fix. But it also checks the new flag 'delta_reversed' without using empty() or isset() which means that existing panes that do not have that field set will cause notices. Other than that it looks okay.