You are here

class EntityReferenceCurrentInstanceBehavior in Entityreference Current 7

Hierarchy

Expanded class hierarchy of EntityReferenceCurrentInstanceBehavior

1 string reference to 'EntityReferenceCurrentInstanceBehavior'
current.inc in plugins/behavior/current.inc

File

plugins/behavior/EntityReferenceCurrentInstanceBehavior.class.php, line 3

View source
class EntityReferenceCurrentInstanceBehavior extends EntityReference_BehaviorHandler_Abstract {

  /**
   * Generate a settings form for this handler.
   */
  public function settingsForm($field, $instance) {
    $field_name = $field['field_name'];
    $form['action'] = array(
      '#type' => 'select',
      '#title' => t('Action'),
      '#options' => array(
        'none' => t('Do nothing'),
        'hide' => t('Hide field'),
        'disable' => t('Disable field'),
      ),
      '#description' => t('Action to take when prepopulating field with values via Current Entity(Menu Object).'),
    );
    $form['action_on_edit'] = array(
      '#type' => 'checkbox',
      '#title' => t('Apply action on edit'),
      '#description' => t('Apply action when editing an existing entity.'),
      '#states' => array(
        'invisible' => array(
          ':input[name="instance[settings][behaviors][current][action]"]' => array(
            'value' => 'none',
          ),
        ),
      ),
    );
    $form['fallback'] = array(
      '#type' => 'select',
      '#title' => t('Fallback behaviour'),
      '#description' => t('Determine what should happen if no values are provided via via Current Entity(Menu Object).'),
      '#options' => array(
        'none' => t('Do nothing'),
        'hide' => t('Hide field'),
        'form_error' => t('Set form error'),
        'redirect' => t('Redirect'),
      ),
    );

    // Get list of permissions.
    $perms = array();
    $perms[0] = t('- None -');
    foreach (module_list(FALSE, FALSE, TRUE) as $module) {

      // By keeping them keyed by module we can use optgroups with the
      // 'select' type.
      if ($permissions = module_invoke($module, 'permission')) {
        foreach ($permissions as $id => $permission) {
          $perms[$module][$id] = strip_tags($permission['title']);
        }
      }
    }
    $form['skip_perm'] = array(
      '#type' => 'select',
      '#title' => t('Skip access permission'),
      '#description' => t('Set a permission that will not be affected by the fallback behavior.'),
      '#options' => $perms,
    );
    $form['use_uid'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use the Author for an entity if target type is user.'),
      '#description' => t('If the target type is User but the current page is a Node select the Author as the entity.'),
    );
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityReferenceCurrentInstanceBehavior::settingsForm public function Generate a settings form for this handler. Overrides EntityReference_BehaviorHandler_Abstract::settingsForm
EntityReference_BehaviorHandler_Abstract::$behavior protected property The name of the behavior plugin.
EntityReference_BehaviorHandler_Abstract::$plugin protected property The plugin definition.
EntityReference_BehaviorHandler_Abstract::access public function Determine if handler should appear. Overrides EntityReference_BehaviorHandler::access 1
EntityReference_BehaviorHandler_Abstract::delete public function Act before deleting an entity with an entity reference field. Overrides EntityReference_BehaviorHandler::delete 2
EntityReference_BehaviorHandler_Abstract::entityPostDelete public function Act after deleting an entity. Overrides EntityReference_BehaviorHandler::entityPostDelete
EntityReference_BehaviorHandler_Abstract::entityPostInsert public function Act after inserting an entity. Overrides EntityReference_BehaviorHandler::entityPostInsert 1
EntityReference_BehaviorHandler_Abstract::entityPostUpdate public function Act after updating an entity. Overrides EntityReference_BehaviorHandler::entityPostUpdate 1
EntityReference_BehaviorHandler_Abstract::insert public function Act before inserting an entity reference field. Overrides EntityReference_BehaviorHandler::insert 2
EntityReference_BehaviorHandler_Abstract::is_empty_alter public function Alter the empty status of a field item. Overrides EntityReference_BehaviorHandler::is_empty_alter
EntityReference_BehaviorHandler_Abstract::load public function Act on loading entity reference fields of entities. Overrides EntityReference_BehaviorHandler::load 2
EntityReference_BehaviorHandler_Abstract::postDelete public function Act after deleting an entity with an entity reference field. Overrides EntityReference_BehaviorHandler::postDelete
EntityReference_BehaviorHandler_Abstract::postInsert public function Act after inserting an entity reference field. Overrides EntityReference_BehaviorHandler::postInsert
EntityReference_BehaviorHandler_Abstract::postUpdate public function Act after updating an entity reference field. Overrides EntityReference_BehaviorHandler::postUpdate
EntityReference_BehaviorHandler_Abstract::presave public function Act on presaving an entity reference field. Overrides EntityReference_BehaviorHandler::presave
EntityReference_BehaviorHandler_Abstract::property_info_alter public function Alter the properties information of a field instance. Overrides EntityReference_BehaviorHandler::property_info_alter
EntityReference_BehaviorHandler_Abstract::schema_alter public function Alter the field schema. Overrides EntityReference_BehaviorHandler::schema_alter
EntityReference_BehaviorHandler_Abstract::update public function Act before updating an entity reference field. Overrides EntityReference_BehaviorHandler::update 2
EntityReference_BehaviorHandler_Abstract::validate public function Act on validating an entity reference field. Overrides EntityReference_BehaviorHandler::validate
EntityReference_BehaviorHandler_Abstract::views_data_alter public function Alter the views data of a field. Overrides EntityReference_BehaviorHandler::views_data_alter 1
EntityReference_BehaviorHandler_Abstract::__construct public function Constructor for the behavior. Overrides EntityReference_BehaviorHandler::__construct