Your SlideShare is downloading. ×
0
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Field formatters
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Field formatters

1,022

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,022
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Field/CCK Formatters“God has given you one face, and you make yourself another.” - Fortune cookie in my desk drawer Helior Colorado ihatespam@helior.info
  • 2. What are Field Formatters?
  • 3. What are Field Formatters?• Means to present field data in a displaying entity
  • 4. What are Field Formatters?• Means to present field data in a displaying entity• Is pluggable
  • 5. What are Field Formatters?• Means to present field data in a displaying entity• Is pluggable• Provides a layer of configurability
  • 6. What are Field Formatters?• Means to present field data in a displaying entity• Is pluggable• Provides a layer of configurability• Is extendable via various methods
  • 7. What are Field Formatters?• Means to present field data in a displaying entity• Is pluggable• Provides a layer of configurability• Is extendable via various methods• If done right, can be reused in any site
  • 8. Defining a Field Formatter:hook_field_formatter_info()labeldescriptionfield typesmultiple valuessettings
  • 9. Rendering a Field Formatter:hook_field_formatter_view()Return an array or renderablearrays – “N is the only number”
  • 10. Providing configurations:hook_field_formatter_settings_form()Standard Form API stuff.Returning a new form element.This will help:$display = $instance[display][$view_mode];$settings = $display[settings];
  • 11. Displaying configuration summary:hook_field_formatter_settings_summary()Output a string of whatever youthink is meaningful.
  • 12. Pre-build formatter processing:hook_field_prepare_view()Custom data massaging goeshere.Rarely used.
  • 13. Review the steps:
  • 14. Review the steps:• Define formatter hook_field_formatter_info()
  • 15. Review the steps:• Define formatter hook_field_formatter_info()• Return array of renderable arrays hook_field_formatter_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)
  • 16. Review the steps:• Define formatter hook_field_formatter_info()• Return array of renderable arrays hook_field_formatter_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)• Optionally provide settings hook_field_formatter_settings_form($field, $instance, $view_mode, $form, & $form_state)
  • 17. Review the steps:• Define formatter hook_field_formatter_info()• Return array of renderable arrays hook_field_formatter_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)• Optionally provide settings hook_field_formatter_settings_form($field, $instance, $view_mode, $form, & $form_state)• Optionally display settings summary hook_field_formatter_settings_summary($field, $instance, $view_mode)
  • 18. Review the steps:• Define formatter hook_field_formatter_info()• Return array of renderable arrays hook_field_formatter_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)• Optionally provide settings hook_field_formatter_settings_form($field, $instance, $view_mode, $form, & $form_state)• Optionally display settings summary hook_field_formatter_settings_summary($field, $instance, $view_mode)• Optionally prepare data before build hook_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)
  • 19. Review the steps:• Define formatter hook_field_formatter_info()• Return array of renderable arrays hook_field_formatter_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)• Optionally provide settings hook_field_formatter_settings_form($field, $instance, $view_mode, $form, & $form_state)• Optionally display settings summary hook_field_formatter_settings_summary($field, $instance, $view_mode)• Optionally prepare data before build hook_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)Useful helpers:
  • 20. Review the steps:• Define formatter hook_field_formatter_info()• Return array of renderable arrays hook_field_formatter_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)• Optionally provide settings hook_field_formatter_settings_form($field, $instance, $view_mode, $form, & $form_state)• Optionally display settings summary hook_field_formatter_settings_summary($field, $instance, $view_mode)• Optionally prepare data before build hook_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, & $items, $display)Useful helpers:• field_info_formatter_types()• field_info_formatter_settings()• field_view_field()• field_view_value()
  • 21. Ideas for Workshop★ HTML5 Audio playback controller ★ Lightbox-likegallery for images★ Email address “mailto:” link ★ Custom date from timestamp★ Link to Twitter account with selectable ★ Fully customizable link from a path styles

×