SlideShare a Scribd company logo
1 of 21
Download to read offline
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
What are Field Formatters?
What are Field Formatters?
• Means to present field data in a
 displaying entity
What are Field Formatters?
• Means to present field data in a
 displaying entity
• Is pluggable
What are Field Formatters?
• Means to present field data in a
 displaying entity
• Is pluggable
• Provides a layer of configurability
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
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
Defining a Field Formatter:
hook_field_formatter_info()


label

description

field types

multiple values

settings
Rendering a Field Formatter:
hook_field_formatter_view()


Return an array or renderable
arrays – “N is the only number”
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'];
Displaying configuration summary:
hook_field_formatter_settings_summary()




Output a string of whatever you
think is meaningful.
Pre-build formatter processing:
hook_field_prepare_view()




Custom data massaging goes
here.

Rarely used.
Review the steps:
Review the steps:
• Define formatter
  hook_field_formatter_info()
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)
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)
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)
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)
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:
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()
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

More Related Content

Similar to Field formatters

Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom fieldIvan Zugec
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017gisborne
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Vlad Savitsky
 
Introducing DataWave
Introducing DataWaveIntroducing DataWave
Introducing DataWaveData Works MD
 
Top 20 something info path 2010 tips and trips - sps-ozarks12
Top 20 something info path 2010 tips and trips - sps-ozarks12Top 20 something info path 2010 tips and trips - sps-ozarks12
Top 20 something info path 2010 tips and trips - sps-ozarks12Kevin Dostalek
 
Rapid Prototyping with PEAR
Rapid Prototyping with PEARRapid Prototyping with PEAR
Rapid Prototyping with PEARMarkus Wolff
 
Deep Dive into Salesforce Integrations: Mapping Engines
Deep Dive into Salesforce Integrations:  Mapping EnginesDeep Dive into Salesforce Integrations:  Mapping Engines
Deep Dive into Salesforce Integrations: Mapping EnginesCRMScienceKirk
 
DrupalCamp 2011 -- Poutine Maker
DrupalCamp 2011 -- Poutine MakerDrupalCamp 2011 -- Poutine Maker
DrupalCamp 2011 -- Poutine Makertavisharmstrong
 
Data Localization and Translation
Data Localization and TranslationData Localization and Translation
Data Localization and TranslationYevhen Shyshkin
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Data localization and translation
Data localization and translationData localization and translation
Data localization and translationMotti Danino
 
One App Cloud - Custom CSS and Javascript
One App Cloud - Custom CSS and Javascript One App Cloud - Custom CSS and Javascript
One App Cloud - Custom CSS and Javascript One App Cloud
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersKacper Gunia
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentNuvole
 
Introduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsIntroduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsZero Point Development
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)tompunk
 

Similar to Field formatters (20)

Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom field
 
Get on with Field API
Get on with Field APIGet on with Field API
Get on with Field API
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
 
The new form framework
The new form frameworkThe new form framework
The new form framework
 
Introducing DataWave
Introducing DataWaveIntroducing DataWave
Introducing DataWave
 
Refactoring
RefactoringRefactoring
Refactoring
 
Top 20 something info path 2010 tips and trips - sps-ozarks12
Top 20 something info path 2010 tips and trips - sps-ozarks12Top 20 something info path 2010 tips and trips - sps-ozarks12
Top 20 something info path 2010 tips and trips - sps-ozarks12
 
Rapid Prototyping with PEAR
Rapid Prototyping with PEARRapid Prototyping with PEAR
Rapid Prototyping with PEAR
 
Drupal 8: Fields reborn
Drupal 8: Fields rebornDrupal 8: Fields reborn
Drupal 8: Fields reborn
 
Deep Dive into Salesforce Integrations: Mapping Engines
Deep Dive into Salesforce Integrations:  Mapping EnginesDeep Dive into Salesforce Integrations:  Mapping Engines
Deep Dive into Salesforce Integrations: Mapping Engines
 
DrupalCamp 2011 -- Poutine Maker
DrupalCamp 2011 -- Poutine MakerDrupalCamp 2011 -- Poutine Maker
DrupalCamp 2011 -- Poutine Maker
 
Data Localization and Translation
Data Localization and TranslationData Localization and Translation
Data Localization and Translation
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Data localization and translation
Data localization and translationData localization and translation
Data localization and translation
 
One App Cloud - Custom CSS and Javascript
One App Cloud - Custom CSS and Javascript One App Cloud - Custom CSS and Javascript
One App Cloud - Custom CSS and Javascript
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
 
Introduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsIntroduction to Advanced Custom Fields
Introduction to Advanced Custom Fields
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
 

More from Helior Colorado

More from Helior Colorado (7)

Theming views
Theming viewsTheming views
Theming views
 
jQuery+Drupal Optimizations
jQuery+Drupal OptimizationsjQuery+Drupal Optimizations
jQuery+Drupal Optimizations
 
Apache Solr
Apache SolrApache Solr
Apache Solr
 
Rss Feeds
Rss FeedsRss Feeds
Rss Feeds
 
Web Standards
Web StandardsWeb Standards
Web Standards
 
The Internet (The Problem With...)
The Internet (The Problem With...)The Internet (The Problem With...)
The Internet (The Problem With...)
 
Using jQuery and CSS to manipulate style and markup
Using jQuery and CSS to manipulate style and markupUsing jQuery and CSS to manipulate style and markup
Using jQuery and CSS to manipulate style and markup
 

Recently uploaded

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameKapil Thakar
 
Planetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Muhammad Tiham Siddiqui
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024Brian Pichman
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIVijayananda Mohire
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveIES VE
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)IES VE
 

Recently uploaded (20)

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First Frame
 
Planetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile Brochure
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)
 

Field formatters

  • 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() label description field types multiple values settings
  • 9. Rendering a Field Formatter: hook_field_formatter_view() Return an array or renderable arrays – “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'];
  • 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