Sunteți pe pagina 1din 2

entityspice

Posted by lootoo on January 13, 2014 at 8:36am

Entity Spice is a Entity API extension. It assumes a lot of defaults, And handles
the repeated tasks and boilerplate code needed to create an entity type. Later
you can override and customize any aspect of the result to your needs.

But why another entity type module?


Entity Spice itself is a completely unobtrusive API and wont stand in your way at
all, you can ignore any part of it which does not suit your needs and roll your own
implementation. It's also a code generator so in the end you will have a complete
module with an entity type defined in it. Modifying the final result will be easy as
a peace of cake. No part of EntitySpice will call your code except one info hook, it's your module (and thus entity type)
who decides ES should handle an aspect of your module or not.

Oven
There is a bonus module also, called Oven, which cooks entity types for you. For now it only has a Drush interface.
After you cooked your entity type you can uninstall and remove Oven completely. It's not bugless but you will not need
it in production site. After cooking your entity you can uninstall it.

The Road Map


Adding custom property/pseudo fields to entity type before cooking it: say you wanted a column in entity table
called number of views...
Add an awesome access API.
Improve documentations.
work in progress.
The access API is not implemented yet. The access API is implemented but it's very basic. You can override it with your
own of-course.

Related/Similar modules
multifield: a field construction module. It could be useful.
ECK: entity construction kit very similar to this module. However your entity type will completely depend on ECK and
Customizing it could be difficult.

Quick how to
Download and enable entityspice with Drush (it only works with Drush.
Use this command to generate an entity type: drush cook my_awesome_entity
If the command was not found try drush cc drush
It will ask you for some parameters, It's better to use defaults for now and customize them later as some of them
are deprecated.
A module named my_awesome_entity will be put in sites/all/modules directory, If you have a contrib directory too
you have to move my_awesome_entity from contrib to custom yourself (will be fixed).
Enable your module: drush en my_awesome_entity (not necessarily with drush).
Use it! check the permissions page for adjusting proper permissions. If you have not customized the paths, they
are as following:
1. /devel/entityspice_info/ ----> Various information about entity types of EntitySpice.
2. /es/ ---->List of all entity types created using EntitySpice.
3. /es/my_awesome_entity similar to /admin/content
4. /es/my_awesome_entity/add ----> /node/add
5. /es/my_awesome_entity/add/BUNDLE ----> /node/add/TYPE
6. /es/my_awesome_entity/% ----> /node/%
7. /es/my_awesome_entity/%/edit ----> /node/%/edit

1 of 2

8. /es/admin/structure/my_awesome_entity ----> /admin/structure/types


* A module/entity type is considered EntitySpice dependent meanwhile it implements the hook_entityspice_info(). If a
day comes you wanted to get rid of EntitySpice in your module you can remove this hook, And EntitySpice will forget
about you.

Projects with similar functionality


ECK (Entity Construction Kit): It generates fieldable entity types too, difference: generated types are handled by
ECK are not an stand-alone module.
Model: An starting point for developing modules, very similar to EntitySpice. However using EntitySpice, you have
more chance of easy customizing and less coding.
Please note: Oven (which is to be used with drush) has issues on windows and windows paths. I'll try to fix it
soon but help from anyone who has access to windows is appreciated,

2 of 2

S-ar putea să vă placă și