SlideShare a Scribd company logo
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 field
Ivan Zugec
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017
gisborne
 
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
Vlad Savitsky
 
Introducing DataWave
Introducing DataWaveIntroducing DataWave
Introducing DataWave
Data Works MD
 
Refactoring
RefactoringRefactoring
Refactoring
Artem Tabalin
 
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 PEAR
Markus 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 Engines
CRMScienceKirk
 
DrupalCamp 2011 -- Poutine Maker
DrupalCamp 2011 -- Poutine MakerDrupalCamp 2011 -- Poutine Maker
DrupalCamp 2011 -- Poutine Maker
tavisharmstrong
 
Data Localization and Translation
Data Localization and TranslationData Localization and Translation
Data Localization and Translation
Yevhen 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 - 4Developers
Kacper 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 Development
Nuvole
 
Introduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsIntroduction to Advanced Custom Fields
Introduction to Advanced Custom Fields
Zero 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

Theming views
Theming viewsTheming views
Theming views
Helior Colorado
 
Apache Solr
Apache SolrApache Solr
Apache Solr
Helior Colorado
 
Rss Feeds
Rss FeedsRss Feeds
Rss Feeds
Helior Colorado
 
The Internet (The Problem With...)
The Internet (The Problem With...)The Internet (The Problem With...)
The Internet (The Problem With...)
Helior Colorado
 
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
Helior Colorado
 

More from Helior Colorado (6)

Theming views
Theming viewsTheming views
Theming views
 
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

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 

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