public function EntityAPIController::invoke

cis7 entity.controller.inc public EntityAPIController::invoke($hook, $entity)
cle7 entity.controller.inc public EntityAPIController::invoke($hook, $entity)
elmsmedia7 entity.controller.inc public EntityAPIController::invoke($hook, $entity)
icor7 entity.controller.inc public EntityAPIController::invoke($hook, $entity)
meedjum_blog7 entity.controller.inc public EntityAPIController::invoke($hook, $entity)
mooc7 entity.controller.inc public EntityAPIController::invoke($hook, $entity)

Implements EntityAPIControllerInterface.

Overrides EntityAPIControllerInterface::invoke

3 calls to EntityAPIController::invoke()
EntityAPIController::delete in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Implements EntityAPIControllerInterface.
EntityAPIController::deleteRevision in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Implements EntityAPIControllerRevisionableInterface::deleteRevision().
EntityAPIController::save in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Implements EntityAPIControllerInterface.
1 method overrides EntityAPIController::invoke()
EntityAPIControllerExportable::invoke in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Overridden to care about reverted bundle entities and to skip Rules.

File

sites/all/modules/ulmus/entity/includes/entity.controller.inc, line 328
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIController
A controller implementing EntityAPIControllerInterface for the database.

Code

public function invoke($hook, $entity) {
  // entity_revision_delete() invokes hook_entity_revision_delete() and
  // hook_field_attach_delete_revision() just as node module does. So we need
  // to adjust the name of our revision deletion field attach hook in order to
  // stick to this pattern.
  $field_attach_hook = ($hook == 'revision_delete' ? 'delete_revision' : $hook);
  if (!empty($this->entityInfo['fieldable']) && function_exists($function = 'field_attach_' . $field_attach_hook)) {
    $function($this->entityType, $entity);
  }

  if (!empty($this->entityInfo['bundle of']) && entity_type_is_fieldable($this->entityInfo['bundle of'])) {
    $type = $this->entityInfo['bundle of'];
    // Call field API bundle attachers for the entity we are a bundle of.
    if ($hook == 'insert') {
      field_attach_create_bundle($type, $entity->{$this->bundleKey});
    }
    elseif ($hook == 'delete') {
      field_attach_delete_bundle($type, $entity->{$this->bundleKey});
    }
    elseif ($hook == 'update' && $entity->original->{$this->bundleKey} != $entity->{$this->bundleKey}) {
      field_attach_rename_bundle($type, $entity->original->{$this->bundleKey}, $entity->{$this->bundleKey});
    }
  }
  // Invoke the hook.
  module_invoke_all($this->entityType . '_' . $hook, $entity);
  // Invoke the respective entity level hook.
  if ($hook == 'presave' || $hook == 'insert' || $hook == 'update' || $hook == 'delete') {
    module_invoke_all('entity_' . $hook, $entity, $this->entityType);
  }
  // Invoke rules.
  if (module_exists('rules')) {
    rules_invoke_event($this->entityType . '_' . $hook, $entity);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.