@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class EntityReferenceFieldBehaviorExample extends EntityReference_BehaviorHandler_Abstract {
|
||||
|
||||
public function load($entity_type, $entities, $field, $instances, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on load!'));
|
||||
}
|
||||
|
||||
public function insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on insert!'));
|
||||
}
|
||||
|
||||
public function update($entity_type, $entity, $field, $instance, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on update!'));
|
||||
}
|
||||
|
||||
public function delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on delete!'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a settings form for this handler.
|
||||
*/
|
||||
public function settingsForm($field, $instance) {
|
||||
$form['test_field'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Field behavior setting'),
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class EntityReferenceInstanceBehaviorExample extends EntityReference_BehaviorHandler_Abstract {
|
||||
|
||||
public function load($entity_type, $entities, $field, $instances, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on load, on the instance level!'));
|
||||
}
|
||||
|
||||
public function insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on insert, on the instance level!'));
|
||||
}
|
||||
|
||||
public function update($entity_type, $entity, $field, $instance, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on update, on the instance level!'));
|
||||
}
|
||||
|
||||
public function delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
|
||||
drupal_set_message(t('Do something on delete, on the instance level!'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a settings form for this handler.
|
||||
*/
|
||||
public function settingsForm($field, $instance) {
|
||||
$form['test_instance'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Instance behavior setting'),
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$plugin = array(
|
||||
'title' => t('Test behavior'),
|
||||
'class' => 'EntityReferenceFieldBehaviorExample',
|
||||
'weight' => 10,
|
||||
'behavior type' => 'field',
|
||||
);
|
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$plugin = array(
|
||||
'title' => t('Test instance behavior'),
|
||||
'class' => 'EntityReferenceInstanceBehaviorExample',
|
||||
'weight' => 10,
|
||||
'behavior type' => 'instance',
|
||||
);
|
Reference in New Issue
Block a user