solrlog-1.0.1/src/Plugin/views/filter/SolrlogTypes.php

src/Plugin/views/filter/SolrlogTypes.php
<?php

namespace Drupal\solrlog\Plugin\views\filter;

use Drupal\Core\Form\FormStateInterface;
use Drupal\solrlog\SolariumTrait;
use Drupal\views\Attribute\ViewsFilter;
use Drupal\views\Plugin\views\filter\InOperator;

/**
 * Exposes log types to views module.
 */
#[ViewsFilter("solrlog_types")]
class SolrlogTypes extends InOperator {

  use SolariumTrait;

  /**
   * {@inheritdoc}
   */
  public function getValueOptions() {
    if (!isset($this->valueOptions)) {
      $this->valueOptions = $this->getLogTypes();
    }
    return $this->valueOptions;
  }

  /**
   * {@inheritdoc}
   */
  protected function valueForm(&$form, FormStateInterface $form_state) {
    parent::valueForm($form, $form_state);
    $form['value']['#access'] = !empty($form['value']['#options']);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc