I am doing a custom plugin area for displaying some data in a views footer (Drupal 8).
I do something about just like this : Create a custom area plugin
The only point is, instead of
#markup in the return array of
render() method, I would like to return some more complex stuff.
If I try to return a textfield if works:
return [ '#type' => 'textfield', ];
If I try another form API element (defined via a
@FormElement): it does not render.
return [ '#type' => 'datetime', ];
Should it render ?
If not, I can render a block there using this (ViewsBlockArea) how to do the equivalent but with a
FormElementinstead ? (actually rendering a form API render array.)
EDIT: Here a the finality of what I want to render:
$element['form'] = [ '#type' => 'commerce_coupon_redemption_form', '#order_id' => $order->id(), '#cardinality' => 1, '#element_ajax' => [ [get_class($this), 'ajaxRefreshSummary'], ], ];
But you may see that more trivial render array like the datetime one given above does not work either.
Also notice that any element defined by a
@FormElement annotation from within the namespace
Drupal\Core\Render\Element is okay.
@FormElement "from elsewhere" like
datetime does not render.