operatorOptions example


  public function canExpose() {
    return TRUE;
  }

  /** * Determine if a filter can be converted into a group. * * Only exposed filters with operators available can be converted into groups. */
  protected function canBuildGroup() {
    return $this->isExposed() && (count($this->operatorOptions()) > 0);
  }

  /** * Returns TRUE if the exposed filter works like a grouped filter. */
  public function isAGroup() {
    return $this->isExposed() && !empty($this->options['is_grouped']);
  }

  /** * Provide the basic form which calls through to subforms. * * If overridden, it is best to call through to the parent, * or to at least make sure all of the functions in this form * are called. */
$this->query->addWhere($this->options['group']$field$this->value['value'], 'REGEXP');
  }

  public function adminSummary() {
    if ($this->isAGroup()) {
      return $this->t('grouped');
    }
    if (!empty($this->options['exposed'])) {
      return $this->t('exposed');
    }

    $options = $this->operatorOptions('short');
    $output = $options[$this->operator];
    if (in_array($this->operator, $this->operatorValues(2))) {
      $output .= ' ' . $this->t('@min and @max', ['@min' => $this->value['min'], '@max' => $this->value['max']]);
    }
    elseif (in_array($this->operator, $this->operatorValues(1))) {
      $output .= ' ' . $this->value['value'];
    }
    return $output;
  }

  /** * Do some minor translation of the exposed input. */
return $options;
  }

  public function adminSummary() {
    if ($this->isAGroup()) {
      return $this->t('grouped');
    }
    if (!empty($this->options['exposed'])) {
      return $this->t('exposed');
    }

    $options = $this->operatorOptions('short');
    $output = '';
    if (!empty($options[$this->operator])) {
      $output = $options[$this->operator];
    }
    if (in_array($this->operator, $this->operatorValues(1))) {
      $output .= ' ' . $this->value;
    }
    return $output;
  }

  protected function operatorValues($values = 1) {
    
Home | Imprint | This part of the site doesn't use cookies.