How to Troubleshoot Apps for the Modern Connected Worker
Get on with Field API
1. Get on with Field API
Drupalcamp Spain - Cáceres 27/10/2013
2. What is Field API
• Included in Drupal 7 from CCK module
• The way to store and represent Entities properties
• Utilizes Form API to insert data
• Flexible and easily extensible
17. But now, what I need...
...is represent basic arithmetic
operations and store its results
18. How would I write it...
• Create our custom field type
• 4 DB columns (operand1, operand 2, operation and value)
• Create our custom widget
• Two text fields for each operand and select for operation
• Black magic to store operation result
• Create our custom formatter
• hook_field_formatter_info_alter()
• Reuse number module formatters
27. Field API in D8
Field types are now plugins: https://drupal.org/node/2064123
Entity based storage: https://drupal.org/node/2078765
Form modes: https://drupal.org/node/2014821
Some others...