This is reliant on #1993312: Change pre_render, post_render, and after_build callbacks to accept callables, but once in we can attach and render callbacks to plugins/handlers. This seems generally a nice idea to me. This function is only applicable to the Drupal\views\Plugin\views\field\Custom handler, but currently lives in views.module. Just doesn't make sense. Patch attached containing #1993312 also, if people want to test.

Steps to test:

- Add a 'Global: Custom text' field handler
- On the handler edit form 'Text' textarea should appear directly below the 'exclude from display' checkbox (screenshot attached)

Files: 
CommentFileSizeAuthor
#8 1993330-8.patch1.9 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 57,214 pass(es).
[ View ]
#5 1993330-5.patch1.9 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 55,895 pass(es).
[ View ]
#3 1993330-3.patch1.83 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 55,678 pass(es).
[ View ]
vdc.move-custom_pre_render-do-not-test.patch1.77 KBdamiankloip
vdc.move-custom_pre_render-with-1993312.patch3.68 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 55,904 pass(es).
[ View ]
Screen Shot 2013-05-13 at 08.08.33.png33.49 KBdamiankloip

Comments

Issue tags:+VDC

.

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Custom.phpundefined
@@ -46,4 +46,16 @@ function render($values) {
+  public function preRender($form) {

Should we document the parameter?

StatusFileSize
new1.83 KB
PASSED: [[SimpleTest]]: [MySQL] 55,678 pass(es).
[ View ]

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Custom.phpundefined
@@ -46,4 +46,19 @@ function render($values) {
+  public function preRender($form) {

Needs also an @return :(

StatusFileSize
new1.9 KB
PASSED: [[SimpleTest]]: [MySQL] 55,895 pass(es).
[ View ]

Bah!

Status:Needs review» Reviewed & tested by the community

Thank you

Status:Reviewed & tested by the community» Needs work

Needs a reroll...

Status:Needs work» Needs review
StatusFileSize
new1.9 KB
PASSED: [[SimpleTest]]: [MySQL] 57,214 pass(es).
[ View ]

Rerolled

Status:Needs review» Reviewed & tested by the community

Rertbced

Status:Reviewed & tested by the community» Fixed

Committed 71eba4f and pushed to 8.x. Thanks!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Title:Move views_handler_field_custom_pre_render_move_text function to a class method on Drupal\views\Plugin\views\field\Custom[Change Notice] Move views_handler_field_custom_pre_render_move_text() function to a class method
Project:Drupal core» Views
Version:8.x-dev» 8.x-3.x-dev
Component:views.module» Code
Status:Closed (fixed)» Active
Issue tags:+Needs change record