Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
You can change this under Settings & Account at any time.
Drupal and Entity Construction Kit
Transcript of Drupal and Entity Construction Kit
A tool provided by Drupal core to facilitate querying for entities based on fields
Drupal and Custom Data
Free Views Integration
Free CRUD Admin UI
make the content editor deal with all that content entry junk.
Free caching (via entities)
Extensible (via fields) possibly by client.
Entity Construction Kit (eck)
Demo the UI now.
What is an entity anyway?
Define entity: a thing with distinct and independent existence.
Some Drupal Vocabulary
A OOP metaphor (not strictly true)
Built-in entity types
Nodes call bundles content types (article, basic page)
Taxonomies call bundles vocabularies (tags)
Users don't allow you to add more bundles (I assume the built in one is called user or account)
Fields on built-in bundles
Nodes have content type fields
Taxonomies have vocabulary fields
Users have account fields
Comments have comment fields
Node - Nodes
Taxonomy - Terms
User - Users
Comment - Comments
Almost Everything in Drupal is an Entity
Mommy make me an entity!
examples module entity
entity api module
Why is everybody so happy?
I like it better for data modeling
it's quick and easy
easy for content editors to use
I assume there must be some performance overhead involved.
for your super duper custom module you might want to roll your own entity the hard way
Entity Construction Kit (eck)
Admin interface lacks bulk crud operations features (fix with views or patch?)
Behaviors are a bit wonky
Drupal Custom Data Options
design your tables
extra work to get views integration
custom code/queries to perform crud on this table
custom caching logic required
extra work to add an admin ui
need entity api to get views integration for free
need entity api to make crud easier
Caching provided by core
extra work to get admin ui
I know! Everything is a node!
Just make your custom tables into entities and you can have:
free views integration
you write all this code to get data into and out of your tables
custom caching code
We want reporting/export
No Views (without extra work)
We want a crud ui (extra work)
We want more columns!
So you want custom data - a progression
My entity journey
comments rave about entity api
hook_entity_info + hook_shema
dang... I have to write my own pager
dang... no views integration
635 lines of code and what have I got?
d7 entities were a late addition
they only provided entity_load
enter entity api (by fago of rules fame) which fills out core functionality
buys me the views integration and CUD
check out the examples!
drush dl model - 9 files + views directory - 5 files
~1832 loc and I have one entity with everything I want
what if I want more than one?
what if I want to rename it?
copy/paste find/replace hell
Are you discouraged yet?
The crud UI for example_entity
Provided by entity api module
make life easy
Which would you rather write?
->entityCondition($name, $value, $operator = NULL)
->propertyCondition($name, $value, $operator = NULL)
->fieldCondition($field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $language_group = NULL)
->propertyOrderBy($column, $direction = 'ASC')
->fieldOrderBy($field, $column, $direction = 'ASC')
->range($start = NULL, $length = NULL)
Creating a new entity