Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jul 2015 at 18:30 UTC
Updated:
5 Sep 2017 at 21:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
osopolarThere should be no problem to invoke
hook_field_formatter_settings_form_alterfor empty settings-forms.Comment #2
azinck commentedThe approach in #1 will not work for modules that don't implement hook_field_formatter_settings_form() at all because the code path never makes it past the
if (function_exists($function)) {check.Updated patch which allows the form alter to be called even if there's no implementation of hook_field_formatter_settings_form().
Comment #3
azinck commentedSorry, forgot the interdiff.
Comment #4
osopolarMy consideration was, that there should not be a settings alter if there is no hook_field_formatter_settings_form implementation. In other words something that does not exist could not be altered, could it? I guess it's more a theoretical/philosophical consideration then practical.
I also had the problem that I wanted to alter a non existing settings-form, so I had to declare it in may custom module like:
In the end, if it is fine to call a alter-function for something that in first place does not exist, then I am fine with #2.
Comment #5
nwom commentedThere was a small problem with a notice being shown and a white space error. I have updated the patch. Please review.
Comment #7
nwom commentedI forgot the case where the variable isn't yet set. Here is the new patch. Please review.
Comment #8
osopolarinterdiff ctools-alter_empty_settings_forms-2537980-2.patch ctools-alter_empty_settings_forms-2537980-7.patch says:
instead of
if (!isset($settings_form) || !$settings_form) {we may useif (empty($settings_form)) {.Comment #9
nwom commented#8 works and applies cleanly.
Comment #10
japerryLooks good to me. Committed.