You are here

interface EntityAPIControllerInterface in Entity API 7

Interface for EntityControllers compatible with the entity API.

Hierarchy

Expanded class hierarchy of EntityAPIControllerInterface

All classes that implement EntityAPIControllerInterface

11 string references to 'EntityAPIControllerInterface'
entity_build_content in ./entity.module
Builds a structured array representing the entity's content.
entity_create in ./entity.module
Create a new entity object.
entity_crud_get_info in ./entity.module
Get the entity info for the entity types provided via the entity CRUD API.
entity_delete_multiple in ./entity.module
Permanently delete multiple entities.
entity_entity_info_alter in ./entity.module
Implements hook_entity_info_alter().

... See full list

File

includes/entity.controller.inc, line 12
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

View source
interface EntityAPIControllerInterface extends DrupalEntityControllerInterface {

  /**
   * Delete permanently saved entities.
   *
   * In case of failures, an exception is thrown.
   *
   * @param $ids
   *   An array of entity IDs.
   */
  public function delete($ids);

  /**
   * Invokes a hook on behalf of the entity. For hooks that have a respective
   * field API attacher like insert/update/.. the attacher is called too.
   */
  public function invoke($hook, $entity);

  /**
   * Permanently saves the given entity.
   *
   * In case of failures, an exception is thrown.
   *
   * @param $entity
   *   The entity to save.
   *
   * @return int
   *   SAVED_NEW or SAVED_UPDATED is returned depending on the operation
   *   performed.
   */
  public function save($entity);

  /**
   * Create a new entity.
   *
   * @param array $values
   *   An array of values to set, keyed by property name.
   *
   * @return object
   *   A new instance of the entity type.
   */
  public function create(array $values = array());

  /**
   * Exports an entity as serialized string.
   *
   * @param $entity
   *   The entity to export.
   * @param $prefix
   *   An optional prefix for each line.
   *
   * @return string
   *   The exported entity as serialized string. The format is determined by
   *   the controller and has to be compatible with the format that is accepted
   *   by the import() method.
   */
  public function export($entity, $prefix = '');

  /**
   * Imports an entity from a string.
   *
   * @param string $export
   *   An exported entity as serialized string.
   *
   * @return object
   *   An entity object not yet saved.
   */
  public function import($export);

  /**
   * Builds a structured array representing the entity's content.
   *
   * The content built for the entity will vary depending on the $view_mode
   * parameter.
   *
   * @param $entity
   *   An entity object.
   * @param $view_mode
   *   View mode, e.g. 'full', 'teaser'...
   * @param $langcode
   *   (optional) A language code to use for rendering. Defaults to the global
   *   content language of the current request.
   *
   * @return array
   *   The renderable array.
   */
  public function buildContent($entity, $view_mode = 'full', $langcode = NULL);

  /**
   * Generate an array for rendering the given entities.
   *
   * @param $entities
   *   An array of entities to render.
   * @param $view_mode
   *   View mode, e.g. 'full', 'teaser'...
   * @param $langcode
   *   (optional) A language code to use for rendering. Defaults to the global
   *   content language of the current request.
   * @param $page
   *   (optional) If set will control if the entity is rendered: if TRUE
   *   the entity will be rendered without its title, so that it can be embedded
   *   in another context. If FALSE the entity will be displayed with its title
   *   in a mode suitable for lists.
   *   If unset, the page mode will be enabled if the current path is the URI
   *   of the entity, as returned by entity_uri().
   *   This parameter is only supported for entities which controller is a
   *   EntityAPIControllerInterface.
   *
   * @return array
   *   The renderable array, keyed by entity name or numeric id.
   */
  public function view($entities, $view_mode = 'full', $langcode = NULL, $page = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalEntityControllerInterface::load public function Loads one or more entities. 1
DrupalEntityControllerInterface::resetCache public function Resets the internal, static entity cache. 1
EntityAPIControllerInterface::buildContent public function Builds a structured array representing the entity's content. 1
EntityAPIControllerInterface::create public function Create a new entity. 1
EntityAPIControllerInterface::delete public function Delete permanently saved entities. 1
EntityAPIControllerInterface::export public function Exports an entity as serialized string. 1
EntityAPIControllerInterface::import public function Imports an entity from a string. 1
EntityAPIControllerInterface::invoke public function Invokes a hook on behalf of the entity. For hooks that have a respective field API attacher like insert/update/.. the attacher is called too. 1
EntityAPIControllerInterface::save public function Permanently saves the given entity. 1
EntityAPIControllerInterface::view public function Generate an array for rendering the given entities. 1