View source
<?php
interface EntityReference_BehaviorHandler {
public function __construct($behavior);
public function schema_alter(&$schema, $field);
public function property_info_alter(&$info, $entity_type, $field, $instance, $field_type);
public function views_data_alter(&$data, $field);
public function load($entity_type, $entities, $field, $instances, $langcode, &$items);
public function is_empty_alter(&$empty, $item, $field);
public function validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors);
public function presave($entity_type, $entity, $field, $instance, $langcode, &$items);
public function insert($entity_type, $entity, $field, $instance, $langcode, &$items);
public function postInsert($entity_type, $entity, $field, $instance);
public function update($entity_type, $entity, $field, $instance, $langcode, &$items);
public function postUpdate($entity_type, $entity, $field, $instance);
public function delete($entity_type, $entity, $field, $instance, $langcode, &$items);
public function postDelete($entity_type, $entity, $field, $instance);
public function entityPostInsert($entity_type, $entity, $field, $instance);
public function entityPostUpdate($entity_type, $entity, $field, $instance);
public function entityPostDelete($entity_type, $entity, $field, $instance);
public function settingsForm($field, $instance);
public function access($field, $instance);
}
abstract class EntityReference_BehaviorHandler_Abstract implements EntityReference_BehaviorHandler {
protected $behavior;
protected $plugin;
public function __construct($behavior) {
$this->behavior = $behavior;
ctools_include('plugins');
$plugin = ctools_get_plugins('entityreference', 'behavior', $behavior);
$this->plugin = $plugin;
}
public function schema_alter(&$schema, $field) {
}
public function property_info_alter(&$info, $entity_type, $field, $instance, $field_type) {
}
public function views_data_alter(&$data, $field) {
}
public function load($entity_type, $entities, $field, $instances, $langcode, &$items) {
}
public function is_empty_alter(&$empty, $item, $field) {
}
public function validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
}
public function presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
}
public function insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
}
public function postInsert($entity_type, $entity, $field, $instance) {
}
public function update($entity_type, $entity, $field, $instance, $langcode, &$items) {
}
public function postUpdate($entity_type, $entity, $field, $instance) {
}
public function delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
}
public function postDelete($entity_type, $entity, $field, $instance) {
}
public function entityPostInsert($entity_type, $entity, $field, $instance) {
}
public function entityPostUpdate($entity_type, $entity, $field, $instance) {
}
public function entityPostDelete($entity_type, $entity, $field, $instance) {
}
public function settingsForm($field, $instance) {
}
public function access($field, $instance) {
return TRUE;
}
}
class EntityReference_BehaviorHandler_Broken extends EntityReference_BehaviorHandler_Abstract {
public function settingsForm($field, $instance) {
$form['behavior_handler'] = array(
'#markup' => t('The selected behavior handler is broken.'),
);
return $form;
}
}