SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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)
 

Mehr von Helior Colorado

Mehr von 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
 

Kürzlich hochgeladen

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Kürzlich hochgeladen (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

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