Download & Extend

hook_condition_execute_CONDITION defined in ffc.api.php doesn't get called.

Project:Field formatter conditions
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I implemented this hook, together with the hook_ffc_conditions_info, etc.. in a custom module, but i noticed that my hook didn't get executed.
The problem is the following:

on line #97 of ffc.module, the fuction name is the following :

$callback = 'ffc_condition_execute_' . $condition['condition'];
if (function_exists($callback)) {
        $callback($build, $field_name, !empty($condition['configuration']) ? $condition['configuration'] : '', $context);
      }

and that's the only function which gets called, no module hooks get called as well.

Imo, there are two solutions: change the hook name to ffc_condition_execute_CONDITION like you did with ffc_condition_form_CONDITION
or make the hook work ;)

Comments

#1

Status:active» needs review

Patch for the second solution: make the hook work.

AttachmentSizeStatusTest resultOperations
ffc-fix_hook_execution-1858630-1.patch1018 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 114 pass(es).View details

#2

Hmm, it's actually not a real hook indeed, it's an automatically generated callback function, both for form or conditions.

The reason why form callbacks now work in a different file is because the info file is loaded during the form alter anyway, execute callbacks need to live in the main module file - for now, and I'd rather let it be that way for now, although I agree it might be confusing. Let me sleep about it a little more :)

#3

Changed the api file, it was confusing indeed.

AttachmentSizeStatusTest resultOperations
1858630-3.patch1.03 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1858630-3.patch. Unable to apply patch. See the log in the details link for more information.View details

#4

Status:needs review» fixed

Committed and pushed (the bot might return red as I've pushed already).

#5

Status:fixed» closed (fixed)
nobody click here