protected function BetterExposedFilters::prependFormElement in Better Exposed Filters 8.5
Same name and namespace in other branches
- 8.4 src/Plugin/views/exposed_form/BetterExposedFilters.php \Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters::prependFormElement()
Inserts a new form element before another element identified by $key.
This can be useful when reordering existing form elements without weights.
Parameters
array $form: The form array to insert the element into.
string $key: The key of the form element you want to prepend the new form element.
array $element: The form element to insert.
Return value
array The form array containing the newly inserted element.
File
- src/
Plugin/ views/ exposed_form/ BetterExposedFilters.php, line 864
Class
- BetterExposedFilters
- Exposed form plugin that provides a basic exposed form.
Namespace
Drupal\better_exposed_filters\Plugin\views\exposed_formCode
protected function prependFormElement(array $form, $key, array $element) {
$pos = array_search($key, array_keys($form)) + 1;
return array_splice($form, 0, $pos - 1) + $element + $form;
}