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
      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

Administration interface and exportability

All of the previous code forces us to use programmatic ways to manage bundles and fields of our entity type. We want administrative users to be able to manage bundles and fields through the web interface. In addition to this, we would like to allow users to export and import bundle configurations. To do so we need the following things:

  • A way to store information about the bundles created by the user
  • Expose that information to Drupal as entities with some extra directives
  • Provide access handling in order to prevent unauthorized users from changing our bundles

Storing bundle information

To store the bundle information, we will use a new database table called recipe_ingredient_type. Add the following table declaration ...

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