Download & Extend

ctools_fields_get_field_formatter_info: Invoke hook_field_formatter_info_alter() before parsing the formatter information

Project:Chaos tool suite (ctools)
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

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

AttachmentSizeStatusTest resultOperations
ctools-fix-field-formatter-helper.patch770 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 68 pass(es).View details | Re-test

Comments

#1

Why doesn't this just use field_info_formatter_types() ?

#2

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

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

#3

crosspost with dave, that looks like consensus.

#4

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

AttachmentSizeStatusTest resultOperations
ctools-fix-field-formatter-helper-1571612-4.patch774 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ctools-fix-field-formatter-helper-1571612-4.patch. Unable to apply patch. See the log in the details link for more information.View details | Re-test

#5

Status:needs review» needs work

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

#6

Status:needs work» needs review

Re-roll

AttachmentSizeStatusTest resultOperations
ctools-fix-field-formatter-helper-1571612-6.patch768 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 68 pass(es).View details | Re-test
nobody click here