Projet

Général

Profil

Paste
Télécharger (1,02 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / entityreference / examples / entityreference_behavior_example / plugins / behavior / EntityReferenceInstanceBehaviorExample.class.php @ 651307cd

1
<?php
2

    
3
class EntityReferenceInstanceBehaviorExample extends EntityReference_BehaviorHandler_Abstract {
4

    
5
  public function load($entity_type, $entities, $field, $instances, $langcode, &$items) {
6
    drupal_set_message(t('Do something on load, on the instance level!'));
7
  }
8

    
9
  public function insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
10
    drupal_set_message(t('Do something on insert, on the instance level!'));
11
  }
12

    
13
  public function update($entity_type, $entity, $field, $instance, $langcode, &$items) {
14
    drupal_set_message(t('Do something on update, on the instance level!'));
15
  }
16

    
17
  public function delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
18
    drupal_set_message(t('Do something on delete, on the instance level!'));
19
  }
20

    
21
  /**
22
   * Generate a settings form for this handler.
23
   */
24
  public function settingsForm($field, $instance) {
25
    $form['test_instance'] = array(
26
      '#type' => 'checkbox',
27
      '#title' => t('Instance behavior setting'),
28
    );
29
    return $form;
30
  }
31
}