Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The $field and $field_name always need to be created regardless if $field_name is array.
if (is_array($field_name)) {
$instance = $field_name;
$field = empty($field_name['field']) ? field_info_field($instance['field_name']) : $field_name['field'];
$field_name = $instance['field_name'];
}
else {
list(, , $bundle) = entity_extract_ids($entity_type, $entity);
$instance = field_info_instance($entity_type, $field_name, $bundle);
}
LINE: 225
Comment | File | Size | Author |
---|---|---|---|
#2 | ctools_field_invoke_field_create_variables_from_instance-2166779-2.patch | 1.05 KB | droath |
Comments
Comment #1
droath CreditAttribution: droath commentedComment #2
droath CreditAttribution: droath commentedComment #3
sergiocarracedo CreditAttribution: sergiocarracedo commentedI resolve doing this:
--- a/sites/all/modules/ctools/includes/fields.inc
+++ b/sites/all/modules/ctools/includes/fields.inc
@@ -230,6 +230,7 @@ function ctools_field_invoke_field($field_name, $op, $entity_type, $entity, &$a
else {
list(, , $bundle) = entity_extract_ids($entity_type, $entity);
$instance = field_info_instance($entity_type, $field_name, $bundle);
+ $field = field_read_field($field_name);
}
Comment #4
MustangGB CreditAttribution: MustangGB commentedIs this still an issue in 1.4/dev?
Comment #5
sergiocarracedo CreditAttribution: sergiocarracedo commentedyes, still failing in last dev version 7.x-1-x-dev
Comment #6
MustangGB CreditAttribution: MustangGB commentedComment #8
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 5 year old patch to fields.inc applied cleanly to the latest ctools 7.x-1.x-dev, but still needs to be officially reviewed and tested by the community (if still applicable).
Comment #9
joelpittetThanks for your patience @droath, I'm quite confident the patch is a great way to normalize and get the same expected results, it's committed to the dev branch.
Comment #11
solideogloria CreditAttribution: solideogloria commentedAny reason why the commit (and release) contains the following change? The change was not in patch #2...
https://git.drupalcode.org/project/ctools/commit/87d82c6
Comment #13
joelpittetComment #14
joelpittetThanks for spotting that, I really don't know where that came from... I scan the diff a few times before committing.🤷♂️
Comment #16
ulethjay CreditAttribution: ulethjay commentedI'm trying figure out why the
empty($field_name['field'])
condition was stripped out when the line was moved down below?Best I can tell, a module I've installed (og_vocab) was using
ctools_field_invoke_field
to invoke a dummy field, but with out this condition that dummy field is totally ignored.