public function FlagViewsFilter::buildOptionsForm in Flag 8.4
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.
Overrides FilterPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ filter/ FlagViewsFilter.php, line 29
Class
- FlagViewsFilter
- Filters content by its flagging status in a view.
Namespace
Drupal\flag\Plugin\views\filterCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['value']['#type'] = 'radios';
$form['value']['#title'] = $this
->t('Status');
$form['value']['#options'] = [
'All' => $this
->t('All'),
1 => $this
->t('Flagged'),
0 => $this
->t('Not flagged'),
];
$form['value']['#default_value'] = isset($this->options['value']) ? $this->options['value'] : 0;
$form['value']['#description'] = '<p>' . $this
->t('This filter is only needed if the relationship used has the "Include only flagged content" option <strong>unchecked</strong>. Otherwise, this filter is useless, because all records are already limited to flagged content.') . '</p><p>' . $this
->t('By choosing <em>Not flagged</em>, it is possible to create a list of content <a href="@unflagged-url">that is specifically not flagged</a>.', [
'@unflagged-url' => 'http://drupal.org/node/299335',
]) . '</p>';
// Workaround for bug in Views: $no_operator class property has no effect.
// TODO: remove when https://www.drupal.org/node/2869191 is fixed.
unset($form['operator']);
unset($form['expose']['use_operator']);
}