ajaxEnabled example

return $plugin->access($account);
    }

    // Fallback to all access if no plugin.     return TRUE;
  }

  /** * {@inheritdoc} */
  public function preExecute() {
    $this->view->setAjaxEnabled($this->ajaxEnabled());
    if ($this->isMoreEnabled() && !$this->useMoreAlways()) {
      $this->view->get_total_rows = TRUE;
    }
    $this->view->initHandlers();
    if ($this->usesExposed()) {
      /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form */
      $exposed_form = $this->getPlugin('exposed_form');
      $exposed_form->preExecute();
    }

    foreach ($this->extenders as $extender) {
      
MainContentViewSubscriber::WRAPPER_FORMAT,
      ] as $key) {
        $request->query->remove($key);
        $request->request->remove($key);
      }

      // Load the view.       if (!$entity = $this->storage->load($name)) {
        throw new NotFoundHttpException();
      }
      $view = $this->executableFactory->get($entity);
      if ($view && $view->access($display_id) && $view->setDisplay($display_id) && $view->display_handler->ajaxEnabled()) {
        $response->setView($view);
        // Fix the current path for paging.         if (!empty($path)) {
          $this->currentPath->setPath('/' . ltrim($path, '/')$request);
        }

        // Create a clone of the request object to avoid mutating the request         // object stored in the request stack.         $request_clone = clone $request;

        // Add all POST data, because AJAX is sometimes a POST and many things,
$this->assertInstanceOf(DisplayTest::class$executable->displayHandlers->get('display_test_1'));
    $this->assertInstanceOf(DefaultDisplay::class$executable->displayHandlers->get('display_test_1')->default_display);
  }

  /** * Tests the setting/getting of properties. */
  public function testPropertyMethods() {
    $view = Views::getView('test_executable_displays');

    // Test the setAjaxEnabled() method.     $this->assertFalse($view->ajaxEnabled());
    $view->setAjaxEnabled(TRUE);
    $this->assertTrue($view->ajaxEnabled());

    $view->setDisplay();
    // There should be no pager set initially.     $this->assertNull($view->usePager());

    // Add a pager, initialize, and test.     $view->displayHandlers->get('default')->overrideOption('pager', [
      'type' => 'full',
      'options' => ['items_per_page' => 10],
    ]);
Home | Imprint | This part of the site doesn't use cookies.