You are here

class BootstrapTourStepInlineEntityFormController in Bootstrap Tour 7.2

Class BootstrapTourStepInlineEntityFormController

Adjusts the Inline Entity Form used for adding/editing/removing tour steps.

Hierarchy

Expanded class hierarchy of BootstrapTourStepInlineEntityFormController

1 string reference to 'BootstrapTourStepInlineEntityFormController'
bootstrap_tour_entity_info in ./bootstrap_tour.module
Implements hook_entity_info().

File

includes/bootstrap_tour.controller.inc, line 116
Defines the inline entity form controller for BootstrapTourStep entities.

View source
class BootstrapTourStepInlineEntityFormController extends EntityInlineEntityFormController {

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

  /**
   * Overrides EntityInlineEntityFormController::tableFields().
   */
  public function tableFields($bundles) {
    $fields = parent::tableFields($bundles);
    $fields['title']['label'] = t('Popup Title');
    $fields['selector'] = array(
      'type' => 'property',
      'label' => t('CSS Selector'),
      'weight' => 100,
    );
    $fields['placement'] = array(
      'type' => 'property',
      'label' => t('Placement'),
      'weight' => 101,
    );
    $fields['path'] = array(
      'type' => 'property',
      'label' => t('Path'),
      'weight' => 102,
    );
    return $fields;
  }

  /**
   * Overrides EntityInlineEntityFormController::entityForm().
   */
  public function entityForm($entity_form, &$form_state) {
    $step = $entity_form['#entity'];
    $entity_form['path'] = array(
      '#type' => 'textfield',
      '#title' => t('Path'),
      '#description' => t('Upon which path should this step be displayed? If subsequent steps will use the same path as previous step(s), you can leave this blank. Enter <front> for the front page.'),
      '#default_value' => !empty($step->path) ? $step->path : '',
    );
    $entity_form['selector'] = array(
      '#type' => 'textfield',
      '#title' => t('CSS Selector'),
      '#size' => 50,
      '#maxlength' => 255,
      '#default_value' => !empty($step->selector) ? $step->selector : '',
    );
    $entity_form['placement'] = array(
      '#type' => 'select',
      '#title' => t('Placement'),
      '#options' => array(
        'top' => t('Top'),
        'bottom' => t('Bottom'),
        'left' => t('Left'),
        'right' => t('Right'),
      ),
      '#default_value' => !empty($step->placement) ? $step->placement : '',
    );
    $entity_form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Popup Title'),
      '#required' => TRUE,
      '#default_value' => !empty($step->title) ? $step->title : '',
    );
    $entity_form['content'] = array(
      '#type' => 'text_format',
      '#base_type' => 'textarea',
      '#title' => t('Popup Content'),
      '#format' => !empty($step->content_text_format) ? $step->content_text_format : NULL,
      '#default_value' => !empty($step->content) ? $step->content : '',
    );
    $langcode = entity_language('bootstrap_tour_step', $step);
    field_attach_form('bootstrap_tour_step', $step, $entity_form, $form_state, $langcode);
    return $entity_form;
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
BootstrapTourStepInlineEntityFormController::defaultLabels public function Overrides EntityInlineEntityFormController::defaultLabels(). Overrides EntityInlineEntityFormController::defaultLabels
BootstrapTourStepInlineEntityFormController::entityForm public function Overrides EntityInlineEntityFormController::entityForm(). Overrides EntityInlineEntityFormController::entityForm
BootstrapTourStepInlineEntityFormController::entityFormSubmit public function Overrides EntityInlineEntityFormController::entityFormSubmit(). Overrides EntityInlineEntityFormController::entityFormSubmit
BootstrapTourStepInlineEntityFormController::tableFields public function Overrides EntityInlineEntityFormController::tableFields(). Overrides EntityInlineEntityFormController::tableFields
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::defaultSettings public function Returns an array of default settings in the form of key => value. 2
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::settingsForm public function Returns the settings form for the current entity type. 2
EntityInlineEntityFormController::__construct public function 1