class Display

Provides a form for editing the Views display.

Hierarchy

Expanded class hierarchy of Display

7 string references to 'Display'
DisplayInternalLogicTest::getInfo in drupal/core/modules/layout/lib/Drupal/layout/Tests/DisplayInternalLogicTest.php
DisplayTest::getInfo in drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php
ReorderDisplays::buildForm in drupal/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ReorderDisplays.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
Result::buildOptionsForm in drupal/core/modules/views/lib/Drupal/views/Plugin/views/area/Result.php
Default options form that provides the label widget that all fields should have.
template_preprocess_views_ui_view_info in drupal/core/modules/views_ui/views_ui.theme.inc
Implements hook_preprocess_HOOK() for theme_views_ui_view_info().

... See full list

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/Display.php, line 15
Contains \Drupal\views_ui\Form\Ajax\Display.

Namespace

Drupal\views_ui\Form\Ajax
View source
class Display extends ViewsFormBase {

  /**
   * Constucts a new Display object.
   */
  public function __construct($type = NULL) {
    $this
      ->setType($type);
  }

  /**
   * Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
   */
  public function getFormKey() {
    return 'display';
  }

  /**
   * Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getFormState().
   *
   * @todo Remove this and switch all usage of $form_state['section'] to
   *   $form_state['type'].
   */
  public function getFormState(ViewStorageInterface $view, $display_id, $js) {
    return array(
      'section' => $this->type,
    ) + parent::getFormState($view, $display_id, $js);
  }

  /**
   * Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
   */
  public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL) {
    $this
      ->setType($type);
    return parent::getForm($view, $display_id, $js);
  }

  /**
   * Implements \Drupal\Core\Form\FormInterface::getFormID().
   */
  public function getFormID() {
    return 'views_ui_edit_display_form';
  }

  /**
   * Implements \Drupal\Core\Form\FormInterface::buildForm().
   */
  public function buildForm(array $form, array &$form_state) {
    $view =& $form_state['view'];
    $display_id = $form_state['display_id'];
    $section = $form_state['section'];
    $executable = $view
      ->get('executable');
    if (!$executable
      ->setDisplay($display_id)) {
      views_ajax_error(t('Invalid display id @display', array(
        '@display' => $display_id,
      )));
    }
    $display =& $executable->display[$display_id];

    // Get form from the handler.
    $form['options'] = array(
      '#theme_wrappers' => array(
        'container',
      ),
      '#attributes' => array(
        'class' => array(
          'scroll',
        ),
      ),
    );
    $executable->display_handler
      ->buildOptionsForm($form['options'], $form_state);

    // The handler options form sets $form['#title'], which we need on the entire
    // $form instead of just the ['options'] section.
    $form['#title'] = $form['options']['#title'];
    unset($form['options']['#title']);

    // Move the override dropdown out of the scrollable section of the form.
    if (isset($form['options']['override'])) {
      $form['override'] = $form['options']['override'];
      unset($form['options']['override']);
    }
    $name = NULL;
    if (isset($form_state['update_name'])) {
      $name = $form_state['update_name'];
    }
    $view
      ->getStandardButtons($form, $form_state, 'views_ui_edit_display_form', $name);
    return $form;
  }

  /**
   * Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::validateForm().
   */
  public function validateForm(array &$form, array &$form_state) {
    $form_state['view']
      ->get('executable')->displayHandlers
      ->get($form_state['display_id'])
      ->validateOptionsForm($form['options'], $form_state);
    if (form_get_errors()) {
      $form_state['rerender'] = TRUE;
    }
  }

  /**
   * Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
   */
  public function submitForm(array &$form, array &$form_state) {
    $form_state['view']
      ->get('executable')->displayHandlers
      ->get($form_state['display_id'])
      ->submitOptionsForm($form['options'], $form_state);
    $form_state['view']
      ->cacheSet();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Display::buildForm public function Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides FormInterface::buildForm
Display::getForm public function Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm(). Overrides ViewsFormBase::getForm
Display::getFormID public function Implements \Drupal\Core\Form\FormInterface::getFormID(). Overrides FormInterface::getFormID
Display::getFormKey public function Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey(). Overrides ViewsFormInterface::getFormKey
Display::getFormState public function Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getFormState(). Overrides ViewsFormBase::getFormState
Display::submitForm public function Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm(). Overrides ViewsFormBase::submitForm
Display::validateForm public function Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::validateForm(). Overrides ViewsFormBase::validateForm
Display::__construct public function Constucts a new Display object.
ViewsFormBase::$id protected property The ID of the item this form is manipulating.
ViewsFormBase::$type protected property The type of item this form is manipulating.
ViewsFormBase::setID protected function Sets the ID for this form.
ViewsFormBase::setType protected function Sets the type for this form.