You are here

class MerciRestrictionInlineEntityFormController in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

@file Defines the inline entity form controller for Nodes.

Hierarchy

Expanded class hierarchy of MerciRestrictionInlineEntityFormController

1 string reference to 'MerciRestrictionInlineEntityFormController'
merci_restrictions_entity_info in merci_restrictions/merci_restrictions.module
Implements hook_entity_info().

File

merci_restrictions/includes/merci_restriction.inline_enity_form.inc, line 8
Defines the inline entity form controller for Nodes.

View source
class MerciRestrictionInlineEntityFormController extends EntityInlineEntityFormController {

  /**
   * Overrides EntityInlineEntityFormController::defaultLabels().
   */
  public function defaultLabels() {
    $labels = array(
      'singular' => t('merci restriction'),
      'plural' => t('merci restrictions'),
    );
    return $labels;
  }

  /**
   * Overrides EntityInlineEntityFormController::tableFields().
   */
  public function tableFields($bundles) {

    //$fields = parent::tableFields($bundles);
    $fields = array();
    $fields[MERCI_ALLOWED_ROLES] = array(
      'type' => 'field',
      'label' => t('Role'),
      'formatter' => 'list_default',
      'weight' => 4,
    );
    $fields[MERCI_CHECKOUT_MAX_LENGTH] = array(
      'type' => 'field',
      'label' => t('Checkout Max Length'),
      'formatter' => 'text_default',
      'weight' => 5,
    );
    $fields[MERCI_CHECKOUT_OFFSITE] = array(
      'type' => 'field',
      'label' => t('Checkout Offsite'),
      'formatter' => 'boolean_yes_no',
      'weight' => 6,
    );
    return $fields;
  }

  /**
   * Overrides EntityInlineEntityFormController::defaultSettings().
   */
  public function defaultSettings() {
    $defaults = parent::defaultSettings();

    // Line items should always be deleted when the order is deleted, they
    // are never managed alone.

    //$defaults['delete_references'] = TRUE;
    return $defaults;
  }

  /**
   * Overrides EntityInlineEntityFormController::settingsForm().
   */
  public function settingsForm($field, $instance) {
    $form = parent::settingsForm($field, $instance);

    // Adding existing entities is not supported for line items.

    //$form['allow_existing']['#access'] = FALSE;

    //$form['match_operator']['#access'] = FALSE;
    return $form;
  }

  /**
   * Overrides EntityInlineEntityFormController::entityForm().
   */
  public function entityForm($entity_form, &$form_state) {
    $form = parent::entityForm($entity_form, $form_state);
    return $form;
  }

  /**
   * Overrides EntityInlineEntityFormController::entityFormSubmit().
   */
  public function entityFormSubmit(&$entity_form, &$form_state) {
    $line_item = $entity_form['#entity'];
    $line_item->tid = $form_state['term']->tid;
    parent::entityFormSubmit($entity_form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityInlineEntityFormController::$entityType protected property
EntityInlineEntityFormController::$settings public property
EntityInlineEntityFormController::createClone public function Creates a clone of the given entity. 2
EntityInlineEntityFormController::css public function Returns an array of css filepaths for the current entity type, keyed by theme name. 1
EntityInlineEntityFormController::delete public function Delete permanently saved entities. 1
EntityInlineEntityFormController::entityFormValidate public function Validates the entity form. 2
EntityInlineEntityFormController::entityType public function Returns the entity type managed by this controller.
EntityInlineEntityFormController::getSetting public function Returns a setting value.
EntityInlineEntityFormController::labels public function Returns an array of entity type labels fit for display in the UI.
EntityInlineEntityFormController::removeForm public function Returns the remove form to be shown through the IEF widget. 1
EntityInlineEntityFormController::removeFormSubmit public function Handles the submission of a remove form. Decides what should happen to the entity after the removal confirmation.
EntityInlineEntityFormController::save public function Permanently saves the given entity. 2
EntityInlineEntityFormController::__construct public function 1
MerciRestrictionInlineEntityFormController::defaultLabels public function Overrides EntityInlineEntityFormController::defaultLabels(). Overrides EntityInlineEntityFormController::defaultLabels
MerciRestrictionInlineEntityFormController::defaultSettings public function Overrides EntityInlineEntityFormController::defaultSettings(). Overrides EntityInlineEntityFormController::defaultSettings
MerciRestrictionInlineEntityFormController::entityForm public function Overrides EntityInlineEntityFormController::entityForm(). Overrides EntityInlineEntityFormController::entityForm
MerciRestrictionInlineEntityFormController::entityFormSubmit public function Overrides EntityInlineEntityFormController::entityFormSubmit(). Overrides EntityInlineEntityFormController::entityFormSubmit
MerciRestrictionInlineEntityFormController::settingsForm public function Overrides EntityInlineEntityFormController::settingsForm(). Overrides EntityInlineEntityFormController::settingsForm
MerciRestrictionInlineEntityFormController::tableFields public function Overrides EntityInlineEntityFormController::tableFields(). Overrides EntityInlineEntityFormController::tableFields