buildThemeFunctions example


  public function renderGroupingSets($sets) {
    $output = [];
    $theme_functions = $this->view->buildThemeFunctions($this->groupingTheme);
    foreach ($sets as $set) {
      $level = $set['level'] ?? 0;

      $row = reset($set['rows']);
      // Render as a grouping set.       if (is_array($row) && isset($row['group'])) {
        $single_output = [
          '#theme' => $theme_functions,
          '#view' => $this->view,
          '#grouping' => $this->options['grouping'][$level],
          '#rows' => $set['rows'],
        ];

  public function testBuildThemeFunctions() {
    /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
    /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */
    [$view$display] = $this->setupBaseViewAndDisplay();

    unset($view->display_handler);
    $expected = [
      'test_hook__test_view',
      'test_hook',
    ];
    $this->assertEquals($expected$view->buildThemeFunctions('test_hook'));

    $view->display_handler = $display;
    $expected = [
      'test_hook__test_view__default',
      'test_hook__default',
      'test_hook__one',
      'test_hook__two',
      'test_hook__and_three',
      'test_hook__test_view',
      'test_hook',
    ];
    

      else {
        // On the views.ajax route, set the action to the page we were on.         $form_action = Url::fromUserInput($this->currentPathStack->getPath())->toString();
      }
    }
    else {
      $form_action = $view->getUrl()->toString();
    }

    $form['#action'] = $form_action;
    $form['#theme'] = $view->buildThemeFunctions('views_exposed_form');
    $form['#id'] = Html::cleanCssIdentifier('views_exposed_form-' . $view->storage->id() . '-' . $display['id']);
    // Labels are built too late for inline form errors to work, resulting     // in duplicated messages.     $form['#disable_inline_form_errors'] = TRUE;

    /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form_plugin */
    $exposed_form_plugin = $view->display_handler->getPlugin('exposed_form');
    $exposed_form_plugin->exposedFormAlter($form$form_state);

    // Save the form.     $this->exposedFormCache->setForm($view->storage->id()$view->current_display, $form);

    
public function submitOptionsForm(&$form, FormStateInterface $form_state) {}

  /** * {@inheritdoc} */
  public function query() {}

  /** * {@inheritdoc} */
  public function themeFunctions() {
    return $this->view->buildThemeFunctions($this->definition['theme']);
  }

  /** * {@inheritdoc} */
  public function validate() {
    return [];
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.