Commit eed630f6 authored by webchick's avatar webchick

Issue #2152221 by IshaDakota, steveoliver, joelpittet, InternetDevels,...

Issue #2152221 by IshaDakota, steveoliver, joelpittet, InternetDevels, rteijeiro, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand: Convert theme_radios() to Twig
parent ce9dc746
......@@ -1116,30 +1116,30 @@ function form_pre_render_radio($element) {
}
/**
* Returns HTML for a set of radio button form elements.
* Prepares variables for radios templates.
*
* @param $variables
* Default template: radios.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes, #children.
*
* @ingroup themeable
*/
function theme_radios($variables) {
function template_preprocess_radios(&$variables) {
$element = $variables['element'];
$attributes = array();
$variables['attributes'] = array();
if (isset($element['#id'])) {
$attributes['id'] = $element['#id'];
$variables['attributes']['id'] = $element['#id'];
}
$attributes['class'] = 'form-radios';
$variables['attributes']['class'][] = 'form-radios';
if (!empty($element['#attributes']['class'])) {
$attributes['class'] .= ' ' . implode(' ', $element['#attributes']['class']);
$variables['attributes']['class'] = array_merge($variables['attributes']['class'], $element['#attributes']['class']);
}
if (isset($element['#attributes']['title'])) {
$attributes['title'] = $element['#attributes']['title'];
$variables['attributes']['title'] = $element['#attributes']['title'];
}
return '<div' . new Attribute($attributes) . '>' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>';
$variables['children'] = $element['#children'];
}
/**
......
......@@ -2877,6 +2877,7 @@ function drupal_common_theme() {
),
'radios' => array(
'render element' => 'element',
'template' => 'radios',
),
'date' => array(
'render element' => 'element',
......
{#
/**
* @file
* Default theme implementation for a 'radios' #type form element.
*
* Available variables
* - attributes: A list of HTML attributes for the wrapper element.
* - children: The rendered radios.
*
* @see template_preprocess_radios()
*
* @ingroup themeable
*/
#}
<div{{ attributes }}>{{ children }}</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment