You are here

public function FlexiformFormEntityManagerDefault::executeCallbacks in Flexiform 7

Execute Save Callbacks.

Save callbacks can be registered against an entity_namespace to be run just after (post) or just before (pre) an entity is saved. If an entity is skipped for whatever reason these callbacks do not run.

Parameters

string $type: The type of callback to fire, either 'postSave' or 'preSave'

string $namespace: The namespace of the entity.

1 call to FlexiformFormEntityManagerDefault::executeCallbacks()
FlexiformFormEntityManagerDefault::saveEntities in includes/flexiform.form_entity_manager.inc
Save Entities.

File

includes/flexiform.form_entity_manager.inc, line 357
Contains the default entity manager for flexiforms.

Class

FlexiformFormEntityManagerDefault
Class that manages entities in a flexiform.

Code

public function executeCallbacks($type, $namespace) {
  if (empty($this->callbacks[$type][$namespace])) {
    return;
  }
  foreach ($this->callbacks[$type][$namespace] as $callback) {
    array_unshift($callback['extra_args'], $this
      ->getEntity($namespace));
    call_user_func_array($callback['callback'], $callback['extra_args']);
  }
}