You are here

public function MerciDefaultEntityController::invoke in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

(Internal use) 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.

Overrides EntityAPIControllerInterface::invoke

2 calls to MerciDefaultEntityController::invoke()
MerciDefaultEntityController::delete in merci_line_item/includes/merci_line_item.controller.inc
Delete permanently saved entities.
MerciDefaultEntityController::save in merci_line_item/includes/merci_line_item.controller.inc
Permanently saves the given entity.

File

merci_line_item/includes/merci_line_item.controller.inc, line 92
Provides a central controller for Drupal Commerce.

Class

MerciDefaultEntityController
@file Provides a central controller for Drupal Commerce.

Code

public function invoke($hook, $entity) {
  if (!empty($this->entityInfo['fieldable']) && function_exists($function = 'field_attach_' . $hook)) {
    $function($this->entityType, $entity);
  }

  // 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);
  }
}