first import 1.0-rc5

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2012-10-27 12:36:32 +02:00
commit a3196f9486
29 changed files with 3912 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
name = Entity Reference Behavior Example
description = Provides some example code for implementing Entity Reference behaviors.
core = 7.x
package = Fields
dependencies[] = entityreference
; Information added by drupal.org packaging script on 2012-09-25
version = "7.x-1.0-rc5"
core = "7.x"
project = "entityreference"
datestamp = "1348565045"

View File

@@ -0,0 +1,15 @@
<?php
/**
* @file
* Example module to demonstrate Entity reference behavior handlers.
*/
/**
* Implements hook_ctools_plugin_directory().
*/
function entityreference_behavior_example_ctools_plugin_directory($module, $plugin) {
if ($module == 'entityreference') {
return 'plugins/' . $plugin;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,8 @@
<?php
$plugin = array(
'title' => t('Test behavior'),
'class' => 'EntityReferenceFieldBehaviorExample',
'weight' => 10,
'behavior type' => 'field',
);

View File

@@ -0,0 +1,8 @@
<?php
$plugin = array(
'title' => t('Test instance behavior'),
'class' => 'EntityReferenceInstanceBehaviorExample',
'weight' => 10,
'behavior type' => 'instance',
);