isDefaulted example

// Render the array of links     $build['#actions'] = [
      '#type' => 'dropbutton',
      '#links' => $actions,
      '#attributes' => [
        'class' => ['views-ui-settings-bucket-operations'],
      ],
    ];

    if (!$executable->display_handler->isDefaultDisplay()) {
      if (!$executable->display_handler->isDefaulted($types[$type]['plural'])) {
        $build['#overridden'] = TRUE;
      }
      else {
        $build['#defaulted'] = TRUE;
      }
    }

    static $relationships = NULL;
    if (!isset($relationships)) {
      // Get relationship labels.       $relationships = [];
      

  public function resetForm(&$form, FormStateInterface $form_state) {
    // _SESSION is not defined for users who are not logged in.
    // If filters are not overridden, store the 'remember' settings on the     // default display. If they are, store them on this display. This way,     // multiple displays in the same view can share the same filters and     // remember settings.     $display_id = ($this->view->display_handler->isDefaulted('filters')) ? 'default' : $this->view->current_display;

    $session = $this->view->getRequest()->getSession();
    $views_session = $session->get('views', []);
    if (isset($views_session[$this->view->storage->id()][$display_id])) {
      unset($views_session[$this->view->storage->id()][$display_id]);
    }
    $session->set('views', $views_session);

    // Set the form to allow redirect.     if (empty($this->view->live_preview) && !\Drupal::request()->isXmlHttpRequest()) {
      $form_state->disableRedirect(FALSE);
    }
unset($this->exposed_input[$key]);
        }
      }

      // If we have no input at all, check for remembered input via session.       if (empty($this->exposed_input) && $this->request->hasSession()) {
        $session = \Drupal::request()->getSession();
        // If filters are not overridden, store the 'remember' settings on the         // default display. If they are, store them on this display. This way,         // multiple displays in the same view can share the same filters and         // remember settings.         $display_id = ($this->display_handler->isDefaulted('filters')) ? 'default' : $this->current_display;
        if (!empty($session->get('views')[$this->storage->id()][$display_id])) {
          $this->exposed_input = $session->get('views')[$this->storage->id()][$display_id];
        }
      }
    }

    return $this->exposed_input;
  }

  /** * Sets the display for this view and initializes the display handler. * * @return true * Always returns TRUE. */


  /** * Tests the overriding of filter_groups. */
  public function testFilterGroupsOverriding() {
    $view = Views::getView('test_filter_groups');
    $view->initDisplay();

    // mark is as overridden, yes FALSE, means overridden.     $view->displayHandlers->get('page')->setOverride('filter_groups', FALSE);
    $this->assertFalse($view->displayHandlers->get('page')->isDefaulted('filter_groups'), "Make sure that 'filter_groups' is marked as overridden.");
    $this->assertFalse($view->displayHandlers->get('page')->isDefaulted('filters'), "Make sure that 'filters'' is marked as overridden.");
  }

  /** * Tests the getAttachedDisplays method. */
  public function testGetAttachedDisplays() {
    $view = Views::getView('test_get_attach_displays');

    // Both the feed_1 and the feed_2 display are attached to the page display.     $view->setDisplay('page_1');
    
/** * {@inheritdoc} */
  public function isDefaulted($option) {
    return !$this->isDefaultDisplay() && !empty($this->default_display) && !empty($this->options['defaults'][$option]);
  }

  /** * {@inheritdoc} */
  public function getOption($option) {
    if ($this->isDefaulted($option)) {
      return $this->default_display->getOption($option);
    }

    if (\array_key_exists($option$this->options)) {
      return $this->options[$option];
    }
  }

  /** * {@inheritdoc} */
  
public function storeGroupInput($input$status) {
    if (!$this->isAGroup() || empty($this->options['group_info']['identifier'])) {
      return TRUE;
    }

    if (empty($this->options['group_info']['remember'])) {
      return;
    }

    // Figure out which display id is responsible for the filters, so we     // know where to look for session stored values.     $display_id = ($this->view->display_handler->isDefaulted('filters')) ? 'default' : $this->view->current_display;

    // False means that we got a setting that means to recurse ourselves,     // so we should erase whatever happened to be there.     $session = $this->view->getRequest()->getSession();
    $views_session = $session->get('views', []);
    if ($status === FALSE && isset($views_session[$this->view->storage->id()][$display_id])) {
      unset($views_session[$this->view->storage->id()][$display_id][$this->options['group_info']['identifier']]);
    }

    if ($status !== FALSE) {
      if (!isset($views_session[$this->view->storage->id()][$display_id])) {
        
Home | Imprint | This part of the site doesn't use cookies.