SlideShare una empresa de Scribd logo
1 de 43
toon@puresign.be
                   Drupal FieldAPI
   @toonketels     Pure Sign Breakfast Presentation 16/02/2012
Overview
           ‣   Entities
           ‣   Fields
           ‣   Anatomy of a field
           ‣   Creating a new fieldtype
           ‣   Why using the Field API
           ‣   Resources
Entities
Entities are the things, the data, the information,
 the “stuff”, that we want do deal with in our
                Drupal application.




                                           http://www.istos.it/comment/2882




                                         Entities
Entities
           ‣   An abstraction for content
           ‣   Entities & bundles
           ‣   Created because not everything is a
               node
           ‣   What makes node powerful is their
               fieldability
Fields
The smallest data items we add to entities.




                                       Fields
Field type



    Field



Field instance




 Layers of abstraction
Fields types
               ‣   Contains business logic of field
               ‣   Is conserned with:
                   -   What happens with data loaded
                       from storage layer?
                   -   What should happen with data
                       inputted by user to storage layer?
               ‣   Examples:
                   -   List
                   -   Text
                   -   Price
                   -   Link
Field types
Fields
         ‣   Data structure holding some settings


         ‣   A name and a type
             ‣   Link: field_website


         ‣   Some cannot be reverted, influence
             on db


         ‣   Settings apply everywhere field is
             used
Field
Field
Field
Field instance
                 ‣   A field attached to a bundle


                 ‣   Adds bundle specific settings


                 ‣   bundle_fieldname
Field
Field
Anatomy of a Field
Field



                        Display
Input widget
                       formatter




               Anatomy of a field
Creating a new fieldtype
3 parts
          ‣   Defining a field


          ‣   Defining an input widget


          ‣   Defining a formatter
Field
        ‣   hook_field_info()
        ‣   hook_field_schema()
        ‣   hook_field_validate()
        ‣   hook_field_is_empty()
Widget
         ‣   hook_field_widget_info()
         ‣   hook_field_widget_form()
Formatter
            ‣   hook_field_formatter_info()
            ‣   hook_field_formatter_view()
Formatter
Code example
Why using the Field API
Why?
       ‣   It’s the way it goes...
Reusability
              ‣   Module: enable on any site


              ‣   We define a type
                  ‣   Can be attached to any entity
                      bundle
                  ‣   User can customize it
                  ‣   Create an instance
Pluggable      ‣   Decoupling
architecture
                   ‣   Field data
                   ‣   Input widget
                   ‣   Display


               ‣   Other devs can
                   ‣   Create input widgets
                   ‣   Create formatters
                   ‣   Alter (alter hooks)
Storage    ‣   We don’t write sql
agnostic
               ‣   Data retrieval done for us
               ‣   Only implement schema


           ‣   Storage engine independent
Settings for
free           ‣   Settings for free
                   ‣   Required
                   ‣   Help text
                   ‣   Defaults
                   ‣   Single - multiple - max
Settings for free
Single multiple, max number
Consistent UI build for us
UI
     ‣   Configure field
     ‣   Input widget
     ‣   Selection of formatter
Views integration
Views
integration   ‣   Display field
                  ‣   Multiple field settings
              ‣   Filter criteria
                  ‣   compound_one
                  ‣   compound_two
                  ‣   delta
              ‣   Sort criteria
                  ‣   compound_one
                  ‣   compound_two
                  ‣   delta
Features exportability
Display & DS   ‣   Works with DS
                    ‣   (better: DS works with fields)
Resources
Resources
            ‣   http://drupal.org/node/707832
            ‣   http://api.drupal.org/api/drupal/
                modules!field!field.module/group/
                field/7
            ‣   http://api.drupal.org/api/examples/
                field_example
                %21field_example.module/7
toon@puresign.be
   @toonketels     Questions?

Más contenido relacionado

Similar a Pure Sign Breakfast Presentations - Drupal FieldAPI

Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
inovex GmbH
 

Similar a Pure Sign Breakfast Presentations - Drupal FieldAPI (20)

Protocol Buffers and Hadoop at Twitter
Protocol Buffers and Hadoop at TwitterProtocol Buffers and Hadoop at Twitter
Protocol Buffers and Hadoop at Twitter
 
What's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field APIWhat's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field API
 
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in PythonPiterPy 2016: Parallelization, Aggregation and Validation of API in Python
PiterPy 2016: Parallelization, Aggregation and Validation of API in Python
 
Building Highly Customizable iOS Applications on Top of a Core Codebase
Building Highly Customizable iOS Applications on Top of a Core CodebaseBuilding Highly Customizable iOS Applications on Top of a Core Codebase
Building Highly Customizable iOS Applications on Top of a Core Codebase
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless php
 
Drupal jam 2017 services
Drupal jam 2017 servicesDrupal jam 2017 services
Drupal jam 2017 services
 
Fork 4 Developers
Fork 4 DevelopersFork 4 Developers
Fork 4 Developers
 
GraphQL vs. (the) REST
GraphQL vs. (the) RESTGraphQL vs. (the) REST
GraphQL vs. (the) REST
 
Grails EE
Grails EEGrails EE
Grails EE
 
Dynamic binding
Dynamic bindingDynamic binding
Dynamic binding
 
Into to drupal8
Into to drupal8Into to drupal8
Into to drupal8
 
2015 09-02 - transaction log prototype
2015 09-02 - transaction log prototype2015 09-02 - transaction log prototype
2015 09-02 - transaction log prototype
 
Doc store
Doc storeDoc store
Doc store
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 
Cisco connect montreal 2018 saalvare md-program-xr-v2
Cisco connect montreal 2018 saalvare md-program-xr-v2Cisco connect montreal 2018 saalvare md-program-xr-v2
Cisco connect montreal 2018 saalvare md-program-xr-v2
 
Loading Huge Amounts of Data
Loading Huge Amounts of DataLoading Huge Amounts of Data
Loading Huge Amounts of Data
 
How to generate code coverage reports in xcode with slather
How to generate code coverage reports in xcode with slatherHow to generate code coverage reports in xcode with slather
How to generate code coverage reports in xcode with slather
 
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
Bug bites Elephant? Test-driven Quality Assurance in Big Data Application Dev...
 

Último

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Pure Sign Breakfast Presentations - Drupal FieldAPI

  • 1. toon@puresign.be Drupal FieldAPI @toonketels Pure Sign Breakfast Presentation 16/02/2012
  • 2. Overview ‣ Entities ‣ Fields ‣ Anatomy of a field ‣ Creating a new fieldtype ‣ Why using the Field API ‣ Resources
  • 4. Entities are the things, the data, the information, the “stuff”, that we want do deal with in our Drupal application. http://www.istos.it/comment/2882 Entities
  • 5. Entities ‣ An abstraction for content ‣ Entities & bundles ‣ Created because not everything is a node ‣ What makes node powerful is their fieldability
  • 7. The smallest data items we add to entities. Fields
  • 8. Field type Field Field instance Layers of abstraction
  • 9. Fields types ‣ Contains business logic of field ‣ Is conserned with: - What happens with data loaded from storage layer? - What should happen with data inputted by user to storage layer? ‣ Examples: - List - Text - Price - Link
  • 11. Fields ‣ Data structure holding some settings ‣ A name and a type ‣ Link: field_website ‣ Some cannot be reverted, influence on db ‣ Settings apply everywhere field is used
  • 12. Field
  • 13. Field
  • 14. Field
  • 15. Field instance ‣ A field attached to a bundle ‣ Adds bundle specific settings ‣ bundle_fieldname
  • 16. Field
  • 17. Field
  • 18. Anatomy of a Field
  • 19. Field Display Input widget formatter Anatomy of a field
  • 20. Creating a new fieldtype
  • 21. 3 parts ‣ Defining a field ‣ Defining an input widget ‣ Defining a formatter
  • 22. Field ‣ hook_field_info() ‣ hook_field_schema() ‣ hook_field_validate() ‣ hook_field_is_empty()
  • 23. Widget ‣ hook_field_widget_info() ‣ hook_field_widget_form()
  • 24. Formatter ‣ hook_field_formatter_info() ‣ hook_field_formatter_view()
  • 27. Why using the Field API
  • 28. Why? ‣ It’s the way it goes...
  • 29. Reusability ‣ Module: enable on any site ‣ We define a type ‣ Can be attached to any entity bundle ‣ User can customize it ‣ Create an instance
  • 30. Pluggable ‣ Decoupling architecture ‣ Field data ‣ Input widget ‣ Display ‣ Other devs can ‣ Create input widgets ‣ Create formatters ‣ Alter (alter hooks)
  • 31. Storage ‣ We don’t write sql agnostic ‣ Data retrieval done for us ‣ Only implement schema ‣ Storage engine independent
  • 32. Settings for free ‣ Settings for free ‣ Required ‣ Help text ‣ Defaults ‣ Single - multiple - max
  • 36. UI ‣ Configure field ‣ Input widget ‣ Selection of formatter
  • 38. Views integration ‣ Display field ‣ Multiple field settings ‣ Filter criteria ‣ compound_one ‣ compound_two ‣ delta ‣ Sort criteria ‣ compound_one ‣ compound_two ‣ delta
  • 40. Display & DS ‣ Works with DS ‣ (better: DS works with fields)
  • 42. Resources ‣ http://drupal.org/node/707832 ‣ http://api.drupal.org/api/drupal/ modules!field!field.module/group/ field/7 ‣ http://api.drupal.org/api/examples/ field_example %21field_example.module/7
  • 43. toon@puresign.be @toonketels Questions?

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n