Commit 71eba4f1 authored by alexpott's avatar alexpott
Browse files

Issue #1993330 by damiankloip: Move...

Issue #1993330 by damiankloip: Move views_handler_field_custom_pre_render_move_text() function to a class method on Drupal\views\Plugin\views\field\Custom.
parent cd4c61e4
...@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) {
unset($form['alter']['alter_text']); unset($form['alter']['alter_text']);
unset($form['alter']['text']['#states']); unset($form['alter']['text']['#states']);
unset($form['alter']['help']['#states']); unset($form['alter']['help']['#states']);
$form['#pre_render'][] = 'views_handler_field_custom_pre_render_move_text'; $form['#pre_render'][] = array($this, 'preRender');
} }
function render($values) { function render($values) {
...@@ -46,4 +46,22 @@ function render($values) { ...@@ -46,4 +46,22 @@ function render($values) {
return $this->options['alter']['text']; return $this->options['alter']['text'];
} }
/**
* Prerender function to move the textarea to the top of a form.
*
* @param array $form
* The form build array.
*
* @return array
* The modified form build array.
*/
public function preRender($form) {
$form['text'] = $form['alter']['text'];
$form['help'] = $form['alter']['help'];
unset($form['alter']['text']);
unset($form['alter']['help']);
return $form;
}
} }
...@@ -1668,18 +1668,6 @@ function views_element_validate_tags($element, &$form_state) { ...@@ -1668,18 +1668,6 @@ function views_element_validate_tags($element, &$form_state) {
} }
} }
/**
* Prerender function to move the textarea to the top.
*/
function views_handler_field_custom_pre_render_move_text($form) {
$form['text'] = $form['alter']['text'];
$form['help'] = $form['alter']['help'];
unset($form['alter']['text']);
unset($form['alter']['help']);
return $form;
}
/** /**
* Set a cached item in the views cache. * Set a cached item in the views cache.
* *
......
Markdown is supported
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