Создание собственных сущностей с использованием Entity API

Embed Size (px)

Citation preview

Entity API

email: [email protected]: ygerasimovskype: yuriy_gerasimov

d.o.: http://drupal.org/user/257311

Agenda

What are entities?

What is Entity API for?

hook_entity_info() to create entities

Code examples

What are entities?

Entity types defined in core: nodes, users, taxomony terms, vocabularies, comments, files

Core functionality: Common hooks (hook_entity_load(), hook_entity_presave() )

Fieldable

EntityFieldQuery

Every entity should have Controller class

Entity API

entity_load(), entity_save(), entity_create(),

entity_delete()

entity_view(), entity_access(), entity_label(),

entity_uri()

entity_id(), entity_extract_ids()

entity_export(), entity_import()

entity_get_info(), entity_get_property_info()

core

Entity API metadata

Provide property info for your entity type, toGet tokens for all properties, via entity tokens.

Get Views integration (as long the property has an

equivalent column in the base table)

Obtain support of modules building upon it likRules

Search API

Code Demo

Entity API revisions

http://drupal.org/node/996696

Documentation

http://drupal.org/project/entity

Handbook: http://drupal.org/node/878784

http://bxl2011.drupaldays.org/node/313

Examples: commerce, profile2

Entity API

email: [email protected]: ygerasimovskype: yuriy_gerasimov

d.o.: http://drupal.org/user/257311