EntityReferenceFieldBehaviorExample.class.php 944 B

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