EntityReferenceInstanceBehaviorExample.class.php 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class EntityReferenceInstanceBehaviorExample extends EntityReference_BehaviorHandler_Abstract {
  3. public function load($entity_type, $entities, $field, $instances, $langcode, &$items) {
  4. drupal_set_message(t('Do something on load, on the instance level!'));
  5. }
  6. public function insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
  7. drupal_set_message(t('Do something on insert, on the instance level!'));
  8. }
  9. public function update($entity_type, $entity, $field, $instance, $langcode, &$items) {
  10. drupal_set_message(t('Do something on update, on the instance level!'));
  11. }
  12. public function delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
  13. drupal_set_message(t('Do something on delete, on the instance level!'));
  14. }
  15. /**
  16. * Generate a settings form for this handler.
  17. */
  18. public function settingsForm($field, $instance) {
  19. $form['test_instance'] = array(
  20. '#type' => 'checkbox',
  21. '#title' => t('Instance behavior setting'),
  22. );
  23. return $form;
  24. }
  25. }