Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295807

Radios and checkboxes not rendered correctly when used in a custom template

$
0
0

Problem/Motivation

When a render array contains form field with '#type' of "radios" or "checkboxes", and that render array is added to the markup for the block being rendered the title is rendered but not the radio buttons or checkboxes themselves (from '#options').

I can work around this by replacing '#options' with '#children' => [['#type' => 'radio', ...], ['#type' => 'radio', ...], ...], which succeeds in getting the radio buttons rendered, but according to the documentation for Radios or Checkboxes, I should not have to do that.

Steps to reproduce

  1. Create a custom template
  2. Add ['#type' => 'radios', '#title' => 'Whatever', '#options' => [1 => 'Larry', 2 => 'Moe', 3 => 'Curly']] to part of what the custom template is fed.
  3. Observe that the title is rendered, but the radio buttons are not.

Proposed resolution

Render the radio buttons.


Viewing all articles
Browse latest Browse all 295807


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>