You are previewing Programming Drupal 7 Entities.

Programming Drupal 7 Entities

Cover of Programming Drupal 7 Entities by Sammy Spets Published by Packt Publishing
  1. Programming Drupal 7 Entities
    1. Table of Contents
    2. Programming Drupal 7 entities
    3. Credits
    4. About the Author
    5. Acknowledgement
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Using the example code
      5. Conventions
      6. Reader feedback
      7. Customer support
    9. 1. Understanding Entities
      1. Introducing entities
      2. Entity and solution modules
      3. Introducing entity types, bundles, and fields
      4. Powerful entity use cases
      5. Our use case
      6. Summary
    10. 2. Developing with Entity Metadata Wrappers
      1. Introducing entity metadata wrappers
      2. Creating an entity metadata wrapper object
      3. Standard entity properties
      4. Entity introspection
      5. Using an entity metadata wrapper
      6. Safely using text property values
      7. Self-imposed limitation of entity programming
      8. References
      9. A note about EntityFieldQuery
      10. Summary
    11. 3. Developing with Non-fieldable Entities
      1. What are non-fieldable entities?
      2. File entities
      3. Vocabulary entities
      4. Recipe site vocabularies
      5. Summary
    12. 4. Developing with Fieldable Entities
      1. What are fieldable entities?
      2. Node entities
      3. Comment entities
      4. Term entities
      5. Summary
    13. 5. Developing with Fields
      1. Field types
      2. Single-value and multi-value fields
      3. Structure fields
      4. Converting the recipe content type to use fields
      5. Summary
    14. 6. Developing with Field Collections
      1. Before Drupal 7
      2. Creating a field collection field
      3. Field collection entities
      4. Adding a field collection to a node
      5. Attaching a field collection to a content type
      6. Summary
    15. 7. Expose Local Entities
      1. Motivation for exposing entities
      2. Fast track your data exposure
      3. Allow fields on your entity
      4. Give it multiple bundles
      5. Administration interface and exportability
      6. Summary
    16. 8. Expose Remote Entities
      1. Introducing the Remote Entity API
      2. Requirements for exposing remote entities
      3. Implementing remote entity exposure
      4. Running
      5. Adding write support
      6. Customization for your use case
      7. Summary
    17. Index
O'Reilly logo

Converting the recipe content type to use fields

Our conversion of the recipe module to use fully-fledged entities can continue now, and we will convert all of the database fields in the recipe table to entity fields. Converting the structure is only a part of the task. There are many code changes necessary to ensure that all supporting code correctly manipulates the new structure. The steps we will take to upgrade the module code are as follows:

  1. Create the fields using the UI.
  2. Export them to code inside a feature.
  3. Put the exported declarations into recipe module and convert field name prefixes to recipe_.
  4. Tweak the recipe module code so that the old fields don't clobber the new ones in the field admin UI, and add link, number, text, and token modules ...

The best content for your career. Discover unlimited learning on demand for around $1/day.