Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 May 2014 at 10:29 UTC
Updated:
12 Jun 2014 at 19:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jhodgdonOK, this needs to be verified in the code and then added to the docs.
Comment #2
joachim commentedIt was something tripped me up the other day when I was writing a field formatter.
Comment #3
jhodgdonOK, I'm looking at the code. The place where the Display settings page is built is:
https://api.drupal.org/api/drupal/modules!field_ui!field_ui.admin.inc/fu...
What you're saying is definitely true. The display form does this, near the bottom:
So, it does look like we should edit hook_field_formatter_settings_form() to say that if you have a settings form, you also need to implement hook_field_formatter_settings_summary() and make sure it returns a value that does not evaluate to FALSE (a non-empty string). The docs for https://api.drupal.org/api/drupal/modules!field_ui!field_ui.api.php/func... already say this, but I definitely agree it should be mentioned on the settings form hook too.
These two hooks should also be in the group/topic field_formatter, not field_types as they are now. (While we're at it, is it too out of scope to fix hook_field_widget_settings_form to be in group/topic field_widget instead of field_types too, in the same file?)
Comment #4
sachin_s commentedI am updating the documentation hook_field_formatter_settings_form().
Comment #5
sachin_s commentedPlease review the patch. The documentation for hook_field_formatter_settings_form() has been updated to mention that it needs hook_field_formatter_settings_summary() implementation to get invoked.
Comment #6
jhodgdonThanks!
Could we make the wording a little better though? It seems awkward to me.
Maybe:
This hook is not invoked unless hook_field_formatter_settings_summary() returns a non-empty value.
What do you think?
Comment #7
joachim commentedI think that's better, but that's at least a double if not a triple negative! This would be easier to read:
This hook is only invoked if hook_field_formatter_settings_summary() returns a non-empty value.
And also we could perhaps say:
This hook is only invoked if the corresponding implementation of hook_field_formatter_settings_summary() returns a non-empty value for the formatter type.
Comment #8
jhodgdonI like the last option in #7. Can we get a new patch? Thanks!
Comment #9
sachin_s commentedSure, I will update the wordings.
Comment #10
sachin_s commentedPlease review the new patch. Thanks!
Comment #11
sachin_s commentedI am new to d.o contribution, so just wondering if I need to provide an advanced patch using "git format-patch", or just the "git diff" is enough for drupal core.
Comment #12
joachim commentedgit diff is fine.
(For very big patches that change lots of things for different reasons, I sometimes use git format-patch with whichever option it is to make it make a patch instead of a ton of mbox files, as then you get a sequence of changes, each with a comment.)
Comment #13
sachin_s commentedThanks @joachim.
Comment #14
jhodgdonThanks!
Comment #16
sachin_s commented10: doc_update_for_hook_field_formatter_settings_form_requires_summary_hook-2268947-10.patch queued for re-testing.
Comment #17
jhodgdonThanks again! Committed to 7.x.
Comment #18
sachin_s commentedThank you, was my first commit so far :)
Comment #19
jhodgdonCongratulations sachin_s!