These notices are thrown when I choose "Content page: Tags Field" for one Selection Rule in my Variants.

Notice: Undefined index: module in ctools_entity_field_value_ctools_access_summary() (line 213 of /home/content/68/9050068/html/drupal/sites/all/modules/ctools/plugins/access/entity_field_value.inc).
Notice: Undefined variable: elements in ctools_entity_field_value_ctools_access_summary() (line 220 of /home/content/68/9050068/html/drupal/sites/all/modules/ctools/plugins/access/entity_field_value.inc).

It is my understanding that I should be able to use this choice to select pages based on taxonomy term tags. Please help.

Update:
I just got a second set of errors when I tried to do something similar on another Variant

# Notice: Undefined index: value in _ctools_entity_field_value_ctools_access_get_conf_field_values() (line 172 of /home/content/68/9050068/html/drupal/sites/all/modules/ctools/plugins/access/entity_field_value.inc).
# Notice: Undefined index: value in ctools_entity_field_value_ctools_access_check() (line 155 of /home/content/68/9050068/html/drupal/sites/all/modules/ctools/plugins/access/entity_field_value.inc).

Files: 
CommentFileSizeAuthor
#12 Step 1 - add selection rule by tid29.2 KBemixiak
#12 Step 2 - the notice57.26 KBemixiak
#8 1520036-entity-field-8.patch1.84 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 58 pass(es).
[ View ]
#4 ctools-taxonomy-selection-criteria-error-1520036-3.patch1.49 KBKars-T
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]
#2 ctools-taxonomy-selection-criteria-error-1520036-2.patch1.42 KBquinn.mckinsey
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

Comments

Title:Notices thrown when Notices thrown when taxonomy used for selection criteria

It looks like the problem is related to the code on those lines looking for array key 'value' when it should be looking for the array key 'tid' for taxonomy. A quick test of changing lines from

155: if (in_array($field_value['value'], $conf_value_array)) {
172: $conf_values[] = $value['value'];

to

155: if (in_array($field_value['tid'], $conf_value_array)) {
172: $conf_values[] = $value['tid'];

Makes the error go away and the taxonomy selection rule works correctly. Of course this is just a data point and not a fix, because it breaks the selection rule for non-taxonomy criteria. A proper fix will need to account for both cases.

StatusFileSize
new1.42 KB
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

Patch for this problem.

Applies to ctools-7.x.1.0

Instructions of what to look for:
On one of the content types, for instance articles, add a field called "my tag field" that is of type "Term Reference".
In page manager, choose a variant. Under the Contexts tab, add a "taxonomy vocabulary" or "taxonomy term" to the contexts list. Under the Selection rules tab, choose "Node page: my tag field" and select one of the taxonomy terms. The variant now applies to all articles with the selected taxonomy term in the "my tag field" of the article.

Details for programmers:
Modified "Check field value" section of ctools_entity_field_value_ctools_access_check function to account for 'tid' as a possible key in field_value array. This array now accepts 'value' and 'tid' as possible keys, and an Exception is thrown in all other cases.
Modified "Set conf_values" section of _ctools_entity_field_value_ctools_access_get_conf_field_values function to account for 'tid' as a possible key in value array. This array now accepts 'value' and 'tid' as possible keys, and an Exception is thrown in all other cases.

Personal Notes:
I'm not sure if this patch represents the correct way to fix this problem. It hinges on ctools being aware of 'tid' key, which I'm not sure if ctools provides or if another module provides. However, I figured any solution is better than no solution. Feedback is appreciated.

Status:Active» Needs review

Changing status to needs review.

Version:7.x-1.0» 7.x-1.x-dev
StatusFileSize
new1.49 KB
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

Hi

I did reroll the patch agains latest 7.x branch so that it doesn't use tabs and applies to the coding standard.

Otherwise we use this patch in a project and it works properly. Sadly I can't give an answer if this is the best way to do this. But it seems to be a correct way. And without this it wouldn't work at all...

FWIW, I tried using the 7.x-1.x-dev version, but am still seeing these errors. Also, and I'm not sure if this is the same issue, my selection criteria reads "tid equals " and then nothing. The tid is getting saved, and the selector works (even with the non-dev version). I just can't see what it is without drilling all the way down to the setting (i.e., not in the variant summary.)

My post in #1630820: entity_field_value is completely broken tries to solve this. Please try it and comment ?

Marked as duplicate #1558708: Ctools bug in term rule ('tid equals') in Panels Selection rules
#4 is wrong because fields could have more than one storage column

Priority:Normal» Major
StatusFileSize
new1.84 KB
PASSED: [[SimpleTest]]: [MySQL] 58 pass(es).
[ View ]

To actually check the field value ctools should iterate through storage fields and compare them one by one

The patch in #8 solved the Issue for me...

I applied this patch to Dev and it didn't solve my problem. But then my use case is different, I am not using a taxonomy reference field. I am using a List (text) field. My values are:

simple|Simple Page
index|Index Page
multi|Multi-Feature Page

I am trying to select a different Panel variant based on the value in the field. i add the field as a selection rule, select any one of the possible values, save the rule and then I see the error discussed above.

In the "Description" it says "value equals" indicating that the value wasn't recognized. If I go to edit the rule, I see the field with none of the values selected.

@capellic do you have this problem without patch?

StatusFileSize
new57.26 KB
new29.2 KB

I applied the patch in #8 and it didn't solve the issue. After the patch applied, I get still same error in same place

Notice: Undefined offset: 0 in ctools_entity_field_value_ctools_access_summary() (line 235 of /sites/all/modules/ctools/plugins/access/entity_field_value.inc).

<?php
 
foreach ($value_keys as $key => $value) { // line 234
   
$values[$value] = $elements[$key]['#markup']; // line 235
 
}
?>

Here some debug info:

<?php
print_r
($value_keys);
/*
Array
(
    [0] => @tid_value
)
*/
?>

<?php
print_r
($values);
/*
Array
(
    [@tid_value] => 7
)
*/
?>

<?php
print_r
($elements);
/*
Array
(
)
*/
?>

#8: 1520036-entity-field-8.patch queued for re-testing.

@emixiak this issue different, see for yours #1630820: entity_field_value is completely broken

Status:Needs review» Fixed

Committed and pushed andypost's patch.

Status:Fixed» Closed (fixed)

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

Posted a similar defect here:
http://drupal.org/node/1812758

Issue summary:View changes

more errors from same problem