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)

Comments

damiankloip’s picture

Issue tags: +VDC

.

dawehner’s picture

+++ 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?

damiankloip’s picture

dawehner’s picture

+++ 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 :(

damiankloip’s picture

StatusFileSize
new1.9 KB

Bah!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Needs a reroll...

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new1.9 KB

Rerolled

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Rertbced

alexpott’s picture

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.

xjm’s picture

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 (for Drupal 7)
Version: 8.x-dev » 8.x-3.x-dev
Component: views.module » Code
Status: Closed (fixed) » Active
Issue tags: +Needs change record
chris matthews’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.7.x-dev
Component: Code » views.module
Issue summary: View changes

For more information as to why this issue was moved to the Drupal core project, please see issue #3030347: Plan to clean process issue queue

chris matthews’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.7.x-dev » 7.x-3.x-dev
Component: views.module » Code
Status: Active » Closed (outdated)

Moving back to the contributed Views issue queue and closing as outdated per https://www.drupal.org/project/views/issues/3030347#comment-13023447