protected function ViewsSimpleMathFieldSort::showSortForm in Views Simple Math Field 8
Same name and namespace in other branches
- 8.2 src/Plugin/views/sort/ViewsSimpleMathFieldSort.php \Drupal\views_simple_math_field\Plugin\views\sort\ViewsSimpleMathFieldSort::showSortForm()
Shortcut to display the value form.
Overrides SortPluginBase::showSortForm
File
- src/
Plugin/ views/ sort/ ViewsSimpleMathFieldSort.php, line 62
Class
- ViewsSimpleMathFieldSort
- Handler which sort by the similarity.
Namespace
Drupal\views_simple_math_field\Plugin\views\sortCode
protected function showSortForm(&$form, FormStateInterface $form_state) {
parent::showSortForm($form, $form_state);
$simpleOptions = [];
$fieldsOptions = $this->displayHandler
->getFieldLabels();
foreach ($fieldsOptions as $key => $value) {
if (strpos($key, 'field_views_simple_math_field') !== FALSE) {
$simpleOptions[$key] = $value;
}
}
if (!empty($simpleOptions)) {
$form['simple'] = [
'#title' => $this
->t('Simple math fields'),
'#type' => 'radios',
'#options' => $simpleOptions,
'#default_value' => $this->options['simple'],
'#required' => TRUE,
];
}
}