API page: http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...
I can find this in Examples module:
* Providing a field requires:
* - Defining a field:
* - hook_field_info()
* - hook_field_schema()
* - hook_field_validate()
* - hook_field_is_empty()
*
* - Defining a formatter for the field (the portion that outputs the field for
* display):
* - hook_field_formatter_info()
* - hook_field_formatter_view()
*
* - Defining a widget for the edit form:
* - hook_field_widget_info()
* - hook_field_widget_form()
*
and from examining core field type modules, it looks like these may be optional:
"hook_field_settings_form",
"hook_field_update_field",
"hook_field_update_forbid",
Comment | File | Size | Author |
---|---|---|---|
#12 | clear_link_to_field_types_topic-1345654-12.patch | 580 bytes | diego21 |
#9 | clear_link_to_field_types_topic-1345654-9.patch | 655 bytes | diego21 |
Comments
Comment #1
jhodgdonThere's a group/topic (which this hook is part of) that lists this information, I think:
http://api.drupal.org/api/drupal/modules--field--field.api.php/group/fie...
Usually we just use the @ingroup topicname to point to stuff like this... Is there documentation missing from this page that should be there? Keep in mind also that we don't really put tutorials on api.drupal.org (or in in-code documentation)...
Comment #2
joachim CreditAttribution: joachim commentedWhat I think this hook should say is something like:
'Along with this hook, the following hooks are also required to define a field type: hook_foo, hook_bar, etc'.
That's not a tutorial, but it's giving essential information that doesn't seem to be there right now.
Comment #3
jhodgdonHow about something more along the lines of "Along with this hook, you also need to implement other hooks. See (link to topic) for more information."? I don't really want to make a comprehensive list of those hooks there -- it's a long list and I think it's better off on that topic (which can be expanded to explain which hooks are required and which optional).
Comment #4
joachim CreditAttribution: joachim commentedThat would work for me.
Comment #5
jhodgdonSounds like a plan then. :)
Comment #6
jhodgdonRelated issue:
#1391118: Clean up Field Types API topic and add settings form hooks
I don't think it's a duplicate though...
Comment #7
chx CreditAttribution: chx commentedThis is still relevant, I just fixed a client's module not implementing _field_is_empty . However, this is not a D8 topic any more, I think... those are plugins now.
Comment #8
jhodgdonGiven the above description of what needs to be done, it sounds like a good D7 novice patch contributor project.
Comment #9
diego21 CreditAttribution: diego21 commentedI hope this patch fix the issue.
Comment #10
joachim CreditAttribution: joachim commentedIsn't there some sort of magic way to link to a group that doesn't require a hardcoded URL to api.d.org?
Comment #11
jhodgdonYes, you can link to a group by using the group identifier (what's in the @defgroup or @ingroup) in a @see or @link.
So
should be
Comment #12
diego21 CreditAttribution: diego21 commentedThanks jhodgdon :-). Didn't know that! I'm gonna learn a lot writing patches ^_^.
Comment #13
joachim CreditAttribution: joachim commentedThe original bug report said that the field info topic needs more details on which hooks you need, but I'm happy to mark this patch RTBC and move on to expanding the field info topic in a new isssue.
Comment #14
jhodgdonThanks again! Committed to 7.x. I think the field info topic is complete enough for 7.x, but if you don't think so, let's open a separate issue.
Comment #15
joachim CreditAttribution: joachim commentedI think it needs to explain which hooks are needed to define a custom field type. I'll file a new issue.