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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

droath’s picture

Issue summary: View changes
droath’s picture

Status: Active » Needs review
FileSize
1.05 KB
sergiocarracedo’s picture

I 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);
}

MustangGB’s picture

Is this still an issue in 1.4/dev?

sergiocarracedo’s picture

yes, still failing in last dev version 7.x-1-x-dev

MustangGB’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Chris Matthews’s picture

The 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).

Checking patch includes/fields.inc...
Hunk #1 succeeded at 238 (offset 14 lines).
Hunk #2 succeeded at 248 (offset 14 lines).
Applied patch includes/fields.inc cleanly.
joelpittet’s picture

Status: Needs review » Fixed
Parent issue: » #3178697: Plan for CTools 7.x-1.18 release

Thanks 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.

  • joelpittet committed 87d82c6 on 7.x-1.x authored by droath
    Issue #2166779 by droath, sergiocarracedo, MustangGB, Chris Matthews:...
solideogloria’s picture

Status: Fixed » Needs work

Any 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

- function ctools_process(&$variables, $hook) {
+ function discardKeyCodectools_process(&$variables, $hook) {

  • joelpittet committed 2abb178 on 7.x-1.x
    Revert "Issue #2166779 by droath, sergiocarracedo, MustangGB, Chris...
  • joelpittet committed bc9f953 on 7.x-1.x authored by droath
    Issue #2166779 by droath, sergiocarracedo, MustangGB, Chris Matthews,...
joelpittet’s picture

Status: Needs work » Fixed
joelpittet’s picture

Thanks for spotting that, I really don't know where that came from... I scan the diff a few times before committing.🤷‍♂️

Status: Fixed » Closed (fixed)

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

ulethjay’s picture

I'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.