Download & Extend

Add checkbox to reverse items in a multiple value field relationship (entity from field plugin)

Project:Chaos tool suite (ctools)
Version:7.x-1.x-dev
Component:Plugins system
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

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.

AttachmentSizeStatusTest resultOperations
entity_from_field.inc_.patch2.16 KBIdlePASSED: [[SimpleTest]]: [MySQL] 24 pass(es).View details | Re-test

Comments

#1

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?

#2

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.

#3

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.

#4

Status:reviewed & tested by the community» needs work

The patch fails code style:

<?php
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.