You are here

function eck_property_behavior_invoke_plugin_alter in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 eck.property_behavior.inc \eck_property_behavior_invoke_plugin_alter()

A general function for beahaviors that are meant to alter data.

Parameters

EntityType $entity_type: The entity type object.

string $function_name: the name of the sub_hook.

array $var: Variable to be altered.

Return value

array most likely, an array returned by a plugin.

5 calls to eck_property_behavior_invoke_plugin_alter()
eck_entity_info_alter in ./eck.module
Implements hook_entity_info_alter().
eck_entity_property_info_alter in ./eck.module
Implements hook_entity_property_info_alter().
eck_schema_alter in ./eck.module
Implements hook_schema_alter().
eck_views_data_alter in views/eck.views.inc
Implements hook_views_data_alter().
eck__bundle__edit_form in ./eck.bundle.inc
Form constructor for the entity bundle editing form.

File

./eck.property_behavior.inc, line 86
Property Behaviors.

Code

function eck_property_behavior_invoke_plugin_alter($entity_type, $function_name, $var) {
  $properties = $entity_type->properties;
  $return = $var;
  foreach ($properties as $property => $info) {

    // If there is a behavior associated with this property we need to call
    // the appropiate hooks.
    if (array_key_exists('behavior', $info) && !empty($info['behavior'])) {
      $behavior = $info['behavior'];
      $plugin = ctools_get_plugins('eck', 'property_behavior', $behavior);
      $function = ctools_plugin_get_function($plugin, $function_name);
      if ($function) {
        if (array_key_exists('behavior_config', $info)) {
          $return['config'] = $info['behavior_config'];
        }
        $return = $function($property, $return);
      }
    }
  }
  return $return;
}