SlideShare a Scribd company logo
Poutine Maker: Custom Fields
         in Drupal 7
         Tavish Armstrong
      tavish@evolvingweb.ca
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
Resources


http://evolvingweb.ca/story/poutine-maker-introduction-field-
                     api-drupal-7-part-1

  http://drupal.org/sandbox/tarmstrong/1188140
https://github.com/tarmstrong/poutine_maker
Custom fields: What are they?


• Custom fields are like a custom data type
• You can also have a custom widgets, formatters, validation
Custom Fields: What are they good for?

• Drupal gives you text fields, date fields, etc.
• It won't give you a colour field. Or a poutine
  field.
• You may want multi-value with a fieldset.
• Fancy widgets?
• Fancy formatting?
• Fancy validation?
DrupalCamp 2011 -- Poutine Maker
Colour picker widget
Alternative: field_collection
Exciting project!
DrupalCamp 2011 -- Poutine Maker
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
hook_field_info()
hook_field_widget_info()
hook_field_formatter_info()
DrupalCamp 2011 -- Poutine Maker
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
hook_field_widget_form()
hook_field_widget_form()
hook_field_widget_form()
hook_field_widget_form()
hook_field_widget_form()
hook_field_widget_form()
hook_field_widget_form()
hook_field_widget_form()
DrupalCamp 2011 -- Poutine Maker
hook_field_is_empty()
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
hook_field_schema()
DrupalCamp 2011 -- Poutine Maker
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
hook_field_widget_error()
hook_field_validate()
hook_field_widget_error()
DrupalCamp 2011 -- Poutine Maker
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
hook_field_formatter_view()

• Take all the saved field items (i.e. each
  $delta) and return a renderable array for
  each

$element[0] = array( first poutine item ... );
$element[1] = array( second poutine item...);
hook_field_formatter_view()
poutine_maker_format_field()
poutine_maker_format_field()
poutine_maker_format_field()
The finished formatter
Agenda
Custom fields
What are they?
What are they good for?

Info() hooks

Creating a widget

Creating a schema

Creating a validator

Creating a formatter

Demo
Resources


http://evolvingweb.ca/story/poutine-maker-introduction-field-
                     api-drupal-7-part-1

  http://drupal.org/sandbox/tarmstrong/1188140
https://github.com/tarmstrong/poutine_maker
Questions?

Tavish Armstrong (tarmstrong)
   tavish@evolvingweb.ca
Ad

More Related Content

Viewers also liked (9)

Chef
ChefChef
Chef
Jeff Wallace
 
Introduction to the Drupal - Web Experience Toolkit
Introduction to the Drupal - Web Experience ToolkitIntroduction to the Drupal - Web Experience Toolkit
Introduction to the Drupal - Web Experience Toolkit
Suzanne Dergacheva
 
Upgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and GotchasUpgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and Gotchas
Suzanne Dergacheva
 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
Suzanne Dergacheva
 
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Suzanne Dergacheva
 
Responsive Design in Drupal with Zen and Zen Grids
Responsive Design in Drupal with Zen and Zen GridsResponsive Design in Drupal with Zen and Zen Grids
Responsive Design in Drupal with Zen and Zen Grids
Suzanne Dergacheva
 
What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8
Suzanne Dergacheva
 
Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7
Suzanne Dergacheva
 
Meilleures pratiques pour construire un site web Drupal
Meilleures pratiques pour construire un site web DrupalMeilleures pratiques pour construire un site web Drupal
Meilleures pratiques pour construire un site web Drupal
Suzanne Dergacheva
 
Introduction to the Drupal - Web Experience Toolkit
Introduction to the Drupal - Web Experience ToolkitIntroduction to the Drupal - Web Experience Toolkit
Introduction to the Drupal - Web Experience Toolkit
Suzanne Dergacheva
 
Upgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and GotchasUpgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and Gotchas
Suzanne Dergacheva
 
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Suzanne Dergacheva
 
Responsive Design in Drupal with Zen and Zen Grids
Responsive Design in Drupal with Zen and Zen GridsResponsive Design in Drupal with Zen and Zen Grids
Responsive Design in Drupal with Zen and Zen Grids
Suzanne Dergacheva
 
What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8
Suzanne Dergacheva
 
Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7
Suzanne Dergacheva
 
Meilleures pratiques pour construire un site web Drupal
Meilleures pratiques pour construire un site web DrupalMeilleures pratiques pour construire un site web Drupal
Meilleures pratiques pour construire un site web Drupal
Suzanne Dergacheva
 

Similar to DrupalCamp 2011 -- Poutine Maker (20)

Field formatters
Field formattersField formatters
Field formatters
Helior Colorado
 
Autoforms
AutoformsAutoforms
Autoforms
jeff kit
 
Buildingplatforms
BuildingplatformsBuildingplatforms
Buildingplatforms
codebits
 
Technical Introduction to YDN
Technical Introduction to YDNTechnical Introduction to YDN
Technical Introduction to YDN
Christian Heilmann
 
The current status of html5 technology and standard
The current status of html5 technology and standardThe current status of html5 technology and standard
The current status of html5 technology and standard
Wonsuk Lee
 
Uniface 10 IDE Under the Hood
Uniface 10 IDE Under the HoodUniface 10 IDE Under the Hood
Uniface 10 IDE Under the Hood
Uniface
 
Extending eZ Platform 2.x with Symfony and React
Extending eZ Platform 2.x with Symfony and ReactExtending eZ Platform 2.x with Symfony and React
Extending eZ Platform 2.x with Symfony and React
Piotr Nalepa
 
Introdution to HTML 5
Introdution to HTML 5Introdution to HTML 5
Introdution to HTML 5
onkar_bhosle
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
qooxdoo 3.5
qooxdoo 3.5qooxdoo 3.5
qooxdoo 3.5
Martin Wittemann
 
cloud computing training institutes in hyderabad
cloud computing training institutes in hyderabadcloud computing training institutes in hyderabad
cloud computing training institutes in hyderabad
mobbisys
 
Change by HTML5
Change by HTML5Change by HTML5
Change by HTML5
dynamis
 
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/DeveloperWordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
my easel
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
Peter Hilton
 
Introduction to Microsoft Bot Framework
Introduction to Microsoft Bot FrameworkIntroduction to Microsoft Bot Framework
Introduction to Microsoft Bot Framework
Sam Fernando
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integration
Lokesh BS
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshell
Lennart Schoors
 
HTML5 Report Card
HTML5 Report CardHTML5 Report Card
HTML5 Report Card
Michael(tm) Smith
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTech
Antya Dev
 
VS 2010 codename Rosario
VS 2010 codename RosarioVS 2010 codename Rosario
VS 2010 codename Rosario
Santosh Kumar Thallam
 
Buildingplatforms
BuildingplatformsBuildingplatforms
Buildingplatforms
codebits
 
The current status of html5 technology and standard
The current status of html5 technology and standardThe current status of html5 technology and standard
The current status of html5 technology and standard
Wonsuk Lee
 
Uniface 10 IDE Under the Hood
Uniface 10 IDE Under the HoodUniface 10 IDE Under the Hood
Uniface 10 IDE Under the Hood
Uniface
 
Extending eZ Platform 2.x with Symfony and React
Extending eZ Platform 2.x with Symfony and ReactExtending eZ Platform 2.x with Symfony and React
Extending eZ Platform 2.x with Symfony and React
Piotr Nalepa
 
Introdution to HTML 5
Introdution to HTML 5Introdution to HTML 5
Introdution to HTML 5
onkar_bhosle
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
cloud computing training institutes in hyderabad
cloud computing training institutes in hyderabadcloud computing training institutes in hyderabad
cloud computing training institutes in hyderabad
mobbisys
 
Change by HTML5
Change by HTML5Change by HTML5
Change by HTML5
dynamis
 
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/DeveloperWordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
my easel
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
Peter Hilton
 
Introduction to Microsoft Bot Framework
Introduction to Microsoft Bot FrameworkIntroduction to Microsoft Bot Framework
Introduction to Microsoft Bot Framework
Sam Fernando
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integration
Lokesh BS
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshell
Lennart Schoors
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTech
Antya Dev
 
Ad

Recently uploaded (20)

Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Ad

DrupalCamp 2011 -- Poutine Maker