Commit 9b3e5d0b authored by Mike Keran's avatar Mike Keran
Browse files

Issue #2886652 by frosev, mikeker: Rewriting filter option should not be...

Issue #2886652 by frosev, mikeker: Rewriting filter option should not be available for textfield/autocomplete filter widgets
parent 56a347f9
......@@ -8,6 +8,8 @@ use Drupal\Core\Render\Element;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\views\Plugin\views\exposed_form\InputRequired;
use Drupal\views\Plugin\views\filter\NumericFilter;
use Drupal\views\Plugin\views\filter\StringFilter;
/**
* Exposed form plugin that provides a basic exposed form.
......@@ -250,11 +252,14 @@ Title Desc|Z -> A</pre> Leave the replacement text blank to remove an option alt
if (!$bef_filter_intro) {
$bef_options['bef_intro'] = array(
'#markup' => '<h3>'
. $this->t('Exposed Filter Settings')
. '</h3><p>'
. $this->t('This section lets you select additional options for exposed filters. Some options are only available in certain situations. If you do not see the options you expect, please see the <a href=":link">BEF settings documentation page</a> for more details.',
array(':link' => Url::fromUri('http://drupal.org/node/1701012')->toString()))
. '</p>',
. $this->t('Exposed Filter Settings')
. '</h3><p>'
. $this->t('This section lets you select additional options for exposed filters. Some options are only available in certain situations. If you do not see the options you expect, please see the <a href=":link">BEF settings documentation page</a> for more details.',
array(
':link' => Url::fromUri('http://drupal.org/node/1701012')
->toString()
))
. '</p>',
);
$bef_filter_intro = TRUE;
}
......@@ -417,8 +422,8 @@ Title Desc|Z -> A</pre> Leave the replacement text blank to remove an option alt
),
),
'#description' => $this->t('Determines the size or amount of each interval or step the slider takes between the min and max.') . '<br />' .
$this->t('The full specified value range of the slider (Range maximum - Range minimum) must be evenly divisible by the step.') . '<br />' .
$this->t('The step must be a positive number of up to 5 decimal places.'),
$this->t('The full specified value range of the slider (Range maximum - Range minimum) must be evenly divisible by the step.') . '<br />' .
$this->t('The step must be a positive number of up to 5 decimal places.'),
);
$bef_options[$label]['slider_options']['bef_slider_animate'] = array(
'#type' => 'textfield',
......@@ -504,22 +509,28 @@ Title Desc|Z -> A</pre> Leave the replacement text blank to remove an option alt
'#description' => $this->t('Places this element in the secondary options portion of the exposed form.'),
);
// Allow rewriting of filter options for any filter.
$bef_options[$label]['more_options']['rewrite'] = array(
'#title' => $this->t('Rewrite filter options'),
'#type' => 'details',
);
$bef_options[$label]['more_options']['rewrite']['filter_rewrite_values'] = array(
'#type' => 'textarea',
'#title' => $this->t('Rewrite the text displayed'),
'#default_value' => $existing[$label]['more_options']['rewrite']['filter_rewrite_values'],
'#description' => $this->t('Use this field to rewrite the filter options displayed. Use the format of current_text|replacement_text, one replacement per line. For example: <pre>
Current|Replacement
On|Yes
Off|No
</pre> Leave the replacement text blank to remove an option altogether. If using hierarchical taxonomy filters, do not including leading hyphens in the current text.
'),
);
// Allow rewriting of filter options for any filter. String and numeric
// filters allow unlimited filter options via textfields, so we can't
// offer rewriting for those.
// @TODO: check other core filter types to see if there are others that
// should be added to this list.
if (!$filter instanceof StringFilter && !$filter instanceof NumericFilter) {
$bef_options[$label]['more_options']['rewrite'] = array(
'#title' => $this->t('Rewrite filter options'),
'#type' => 'details',
);
$bef_options[$label]['more_options']['rewrite']['filter_rewrite_values'] = array(
'#type' => 'textarea',
'#title' => $this->t('Rewrite the text displayed'),
'#default_value' => $existing[$label]['more_options']['rewrite']['filter_rewrite_values'],
'#description' => $this->t('Use this field to rewrite the filter options displayed. Use the format of current_text|replacement_text, one replacement per line. For example: <pre>
Current|Replacement
On|Yes
Off|No
</pre> Leave the replacement text blank to remove an option altogether. If using hierarchical taxonomy filters, do not including leading hyphens in the current text.
'),
);
}
}
/* Ends: foreach ($filters as $filter) { */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment