For some components and configurators I plan to introduce in the future, I want to be able to use static methods in $element['#pre_render'].
Unfortunately this is not possible natively: drupal_render() calls function_exists(), which only allows procedural functions.

Let's introduce a trick for this:

$element['#pre_render'][] = '_renderkit_generic_pre_render';
$element['#renderkit_pre_render'][] = ['MyClass', 'myMethod'];

Comments

donquixote created an issue. See original summary.

  • donquixote committed 7dea24d on 7.x-1.x
    Issue #3084431: Introduce _renderkit_generic_pre_render().
    
donquixote’s picture

Status: Active » Fixed
donquixote’s picture

Component: Code » API

Status: Fixed » Closed (fixed)

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