Problem/Motivation

Currently ctools_fields_get_field_formatter_info() invokes hook_field_formatter_info, processes the output and then invokes hook_field_formatter_info_alter.
Since the processing checks if a specific field type is supported by the field formatter changes of the supported field types by using hook_field_formatter_info_alter won't have any effect.

Proposed resolution

Invoke hook_field_formatter_info_alter right after the invocation of hook_field_formatter_info and before processing the output.

Remaining tasks

Verify that this patch doesn't change an order made intentionally.
At the moment I don't see any reason why the alter hook should be invoked after the output processing.
If there needs to be an alter hook for the processed output I think it should be ctools specific.

User interface changes

none

API changes

none

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Why doesn't this just use field_info_formatter_types() ?

EclipseGc’s picture

So... I think this is probably me who wrote this initially (not for sure) and I'm wondering if we might not be better off with just


 function ctools_fields_get_field_formatter_info($fields) {
   $info = array();
   $field_info = field_info_formatter_types();
//...

I think that likely does what I was looking to do at the time and I just couldn't find it.

Thoughts?

Eclipse

EclipseGc’s picture

crosspost with dave, that looks like consensus.

das-peter’s picture

Oh I wasn't aware of field_info_formatter_types() - updated patch.

Status: Needs review » Needs work

The last submitted patch, ctools-fix-field-formatter-helper-1571612-4.patch, failed testing.

das-peter’s picture

Status: Needs work » Needs review
FileSize
768 bytes

Re-roll

Leksat’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

The file_image_formatters module allows to use image formatters on file fields and vice versa. Before this patch it was not possible to save the formatter settings, they just got lost.
After applying the patch to ctools, it works like a charm!

  • japerry committed fa5e779 on 7.x-1.x authored by das-peter
    Issue #1571612 by das-peter: ctools_fields_get_field_formatter_info:...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Yah this seems like a simple API mismatch. Committed.

  • japerry committed 3ba9025 on 7.x-1.x authored by das-peter
    Issue #1571612 by das-peter: ctools_fields_get_field_formatter_info:...

Status: Fixed » Closed (fixed)

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