function HistoryUserTimestamp::valueForm

Same name and namespace in other branches
  1. 9 core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php \Drupal\history\Plugin\views\filter\HistoryUserTimestamp::valueForm()
  2. 10 core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php \Drupal\history\Plugin\views\filter\HistoryUserTimestamp::valueForm()
  3. 11.x core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php \Drupal\history\Plugin\views\filter\HistoryUserTimestamp::valueForm()

Overrides FilterPluginBase::valueForm

File

core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php, line 49

Class

HistoryUserTimestamp
Filter for new content.

Namespace

Drupal\history\Plugin\views\filter

Code

protected function valueForm(&$form, FormStateInterface $form_state) {
    // Only present a checkbox for the exposed filter itself. There's no way
    // to tell the difference between not checked and the default value, so
    // specifying the default value via the views UI is meaningless.
    if ($form_state->get('exposed')) {
        if (isset($this->options['expose']['label'])) {
            $label = $this->options['expose']['label'];
        }
        else {
            $label = $this->t('Has new content');
        }
        $form['value'] = [
            '#type' => 'checkbox',
            '#title' => $label,
            '#default_value' => $this->value,
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.