operatorValues example

$default_value = (array) $this->value;

    $which = 'all';
    if (!empty($form['operator'])) {
      $source = ':input[name="options[operator]"]';
    }
    if ($exposed) {
      $identifier = $this->options['expose']['identifier'];

      if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
        // exposed and locked.         $which = in_array($this->operator, $this->operatorValues(1)) ? 'value' : 'none';
      }
      else {
        $source = ':input[name="' . $this->options['expose']['operator_id'] . '"]';
      }

      if (!empty($this->options['expose']['reduce'])) {
        $options = $this->reduceValueOptions();

        if (!empty($this->options['expose']['multiple']) && empty($this->options['expose']['required'])) {
          $default_value = [];
        }
      }
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) {
    $options = [];
    foreach ($this->operators() as $id => $info) {
      if (isset($info['values']) && $info['values'] == $values) {
        $options[] = $id;
      }
    }
'#description' => $this->t('Hint text that appears inside the Min field when empty.'),
    ];
    $form['expose']['max_placeholder'] = [
      '#type' => 'textfield',
      '#default_value' => $this->options['expose']['max_placeholder'],
      '#title' => $this->t('Max placeholder'),
      '#size' => 40,
      '#description' => $this->t('Hint text that appears inside the Max field when empty.'),
    ];
    // Setup #states for all operators with two value.     $states = [[':input[name="options[expose][use_operator]"]' => ['checked' => TRUE]]];
    foreach ($this->operatorValues(2) as $operator) {
      $states[] = [
        ':input[name="options[operator]"]' => ['value' => $operator],
      ];
    }
    $form['expose']['min_placeholder']['#states']['visible'] = $states;
    $form['expose']['max_placeholder']['#states']['visible'] = $states;

    $form['expose']['placeholder'] = [
      '#type' => 'textfield',
      '#default_value' => $this->options['expose']['placeholder'],
      '#title' => $this->t('Placeholder'),
      
Home | Imprint | This part of the site doesn't use cookies.