public function InOperator::adminSummary

Display the filter on the administrative summary

Overrides FilterPluginBase::adminSummary

2 calls to InOperator::adminSummary()
Name::adminSummary in drupal/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
Display the filter on the administrative summary
TaxonomyIndexTid::adminSummary in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
Display the filter on the administrative summary
2 methods override InOperator::adminSummary()
Name::adminSummary in drupal/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
Display the filter on the administrative summary
TaxonomyIndexTid::adminSummary in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
Display the filter on the administrative summary

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/InOperator.php, line 311
Definition of Drupal\views\Plugin\views\filter\InOperator.

Class

InOperator
Simple filter to handle matching of multiple options selectable via checkboxes

Namespace

Drupal\views\Plugin\views\filter

Code

public function adminSummary() {
  if ($this
    ->isAGroup()) {
    return t('grouped');
  }
  if (!empty($this->options['exposed'])) {
    return t('exposed');
  }
  $info = $this
    ->operators();
  $this
    ->get_value_options();
  if (!is_array($this->value)) {
    return;
  }
  $operator = check_plain($info[$this->operator]['short']);
  $values = '';
  if (in_array($this->operator, $this
    ->operator_values(1))) {

    // Remove every element which is not known.
    foreach ($this->value as $value) {
      if (!isset($this->value_options[$value])) {
        unset($this->value[$value]);
      }
    }

    // Choose different kind of ouput for 0, a single and multiple values.
    if (count($this->value) == 0) {
      $values = t('Unknown');
    }
    else {
      if (count($this->value) == 1) {

        // If any, use the 'single' short name of the operator instead.
        if (isset($info[$this->operator]['short_single'])) {
          $operator = check_plain($info[$this->operator]['short_single']);
        }
        $keys = $this->value;
        $value = array_shift($keys);
        if (isset($this->value_options[$value])) {
          $values = check_plain($this->value_options[$value]);
        }
        else {
          $values = '';
        }
      }
      else {
        foreach ($this->value as $value) {
          if ($values !== '') {
            $values .= ', ';
          }
          if (drupal_strlen($values) > 8) {
            $values .= '...';
            break;
          }
          if (isset($this->value_options[$value])) {
            $values .= check_plain($this->value_options[$value]);
          }
        }
      }
    }
  }
  return $operator . ($values !== '' ? ' ' . $values : '');
}