Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: http://api.drupal.org/api/drupal/modules--field_ui--field_ui.api.php/fun...
Describe the problem you have found:
This function should be listed at http://api.drupal.org/api/drupal/modules--field--field.api.php/group/fie...
Comments
Comment #1
joachim CreditAttribution: joachim commentedhook_field_instance_settings_form should be too.
Comment #2
sven.lauer CreditAttribution: sven.lauer commentedI suppose one reason why these are not linked presently (though not necessarily a good one) is that these hooks are provided by field_ui.module, while the other field API hooks are provided by field.module itself. I guess this needs discussion in so far one could also make a case for a "Field UI API".
Comment #3
joachim CreditAttribution: joachim commentedAh that would explain why they're not in there.
But from a developer's POV, I want to see a group that lists all the hooks I need to implement to make a practical, working field: that starts with the field type hook and then goes on to the various settings forms, and finally ends with the widget form itself.
Comment #4
sven.lauer CreditAttribution: sven.lauer commentedIFF you are defining a field that is intended to be administered through field UI. If you are writing a module that defines a field that is completely handled through code (perhaps forced to be handled by code by setting no_ui => TRUE), you won't be defining the settings forms.
Not disagreeing that these should be linked in Field Types API, though, just pointing out that there is a difference.
Comment #5
jhodgdonI don't see a reason not to list them, and agree with joachim that they are needed by at least some field type developers. How about a patch?
Comment #6
sven.lauer CreditAttribution: sven.lauer commentedJust waited for another opinion on this. Patch attached.
Comment #7
sven.lauer CreditAttribution: sven.lauer commentedComment #8
jhodgdonSo... This is good, as far as it goes. But I noticed at the top of the file:
This tries to add everything in the file to this topic, but ... the topic does not exist. Also, I don't think @ingroup {} works (should be @addtogroup).
So I think instead of this patch, we should probably add everything in this file to the Field Types API topic, by changing this line (and the closing comment) to the right codes. Shouldn't we?
Also, the existing Field Types API page is kind of ... no it's really really lame.
http://api.drupal.org/api/drupal/core--modules--field--field.api.php/gro...
It has a bunch of @see in it that should be removed, and it needs some grammar cleanup. For consistency, I would say if we are adding functions to that topic, we should add @see lines to the topic, but I would rather see all of those @see lines removed (they are redundant IMO). So can this patch do that too? We can file a separate issue to clean up the grammar/wording of the topic too (or fix it here)...
Comment #9
jhodgdonComment #10
joachim CreditAttribution: joachim commentedIf we're doing clean-up, I would love to see this bit:
> and a variety of other field hooks are called by the Field Attach API to perform field-type-specific actions.
replaced with some sort of list that walks you through the API, sort of like this:
- hook_field_settings_form() allows additional settings for the field as a whole
- hook_field_instance_settings_form() allows additional settings for specific instances of the field
- ... etc
Comment #11
jhodgdonYeah, that would be good. Should we file a separate issue for that?
Comment #12
sven.lauer CreditAttribution: sven.lauer commentedI decided to go ahead and have a shot at rewriting the Field Types API (or should that be called Field Type API?) text.
I started to compile a list of field type hooks that get called by the Field Attach API, but this simply leads to a lot of duplication: Those are basically all the hooks that do not pertain to widgets and formatters, except for hook_field_info[_alter]() and hook_field_schema(). So if we want to have a separate list for those (which makes sense), we really should have a separate topic for field type hooks (sans widget- and formatter-specific stuff).
It has always struck me as somewhat odd that widgets and formatters are included / documented in the Field Types API topic. Perhaps we should simply break these into their own groups (or group, something link "Field (Display) handlers" or something?). Though I guess this would make this a D8 only change, which does not help D7 developers ...
Also, if we mention hook_field_info() in the introduction (as we currently do), maybe we should also add a sentence about hook_field_schema()---for that is where datatypes are really specified (I recall that this stumped me the first time I tried to figure out what exactly the columns and data types for a given field were).
If we had a proper field types topic, we could have something like
Comment #13
sven.lauer CreditAttribution: sven.lauer commentedAaaand the current patch.
Comment #14
jhodgdonUm. This is the same patch as before?
I think making separate topics for definition/formatters/widgets makes sense (the three topics should link to each other). I think that could go into D7 as well as D8.
Comment #15
sven.lauer CreditAttribution: sven.lauer commentedArg, just for the record, here is the correct patch (I am an idiot).
But setting back to "needs work", as I am going to roll a patch that splits the topic.
It would be nice to get this into D7, but webchick hasn't been a fan of patches that reorganize the documentation ...
Comment #16
sven.lauer CreditAttribution: sven.lauer commentedComment #17
sven.lauer CreditAttribution: sven.lauer commentedHere is a patch that splits up the "Field Types API" group into three.
Comment #18
jhodgdonRelated issue (not duplicate I think):
#1345654: hook_field_info should have clear link to the field_types topic, and that topic should say which hooks are needed
Wow, sorry, I apparently forgot to review this and it fell down in my issue list (which runs to many many pages). So I took a look at the patch in #17. It looks mostly good! A few little things to clean up (and likely it also needs to be rerolled):
a) I think Field type doesn't need to be capitalized here:
b) I think the words "to choose" need to be inserted here:
c) Move link down to next line:
Oh dang, I have to run out... didn't get past that in the patch. sorry!
Comment #20
jhodgdonReview of the rest of the patch:
d)
formatter -> formatters
e)
Field type -> non-capitalized
f)
Needs "to choose" in there.
g) Back up towards the top of the patch, I just noticed this:
In that second line, the comma should be a semi-colon (or else put "and" in there).
And did I mention -- Sven, you did a really nice job on this documentation. :) Maybe though in the Widgets and Formatters sections, we should put a line or two kind of like this part of the Field Types section:
Just to give a heads up, like "This is the main hook"?
Comment #21
sven.lauer CreditAttribution: sven.lauer commentedHere is a patch that fixes the issues in #19 and #20. I also added a sentence pointing to the _info hook to the widget and formatter topics.
Thanks for the kind words! And, as usual, thanks for being an awesome doc maintainer!
Comment #22
sven.lauer CreditAttribution: sven.lauer commentedComment #23
jhodgdonDang, this fell off my list again... Let's retest, reroll if necessary, then get this reviewed and committed.
Comment #24
jhodgdon#21: doc-add-settings-hooks-to-field-type-group-1391118-4.patch queued for re-testing.
Comment #26
jhodgdon#21: doc-add-settings-hooks-to-field-type-group-1391118-4.patch queued for re-testing.
Comment #27
jhodgdonGreat! Committed to 8.x and 7.x.