I need to style my radios as tabs. So I created a form element like this:
$form['important_categories'] = array (
'#type' => 'radios',
'#label' => NULL,
'#attributes' => array (
'class' => array (
'radioTabs',
),
),
);
foreach ($important_categories as $id_important_category => $important_category_name) {
$form['important_categories']['#options'][$id_important_category] = $important_category_name;
if(!isset($form['important_categories']['#default_value'])) {
$form['important_categories']['#default_value'] = $id_important_category;
}
}
This properly sets options, and sets first element as default. However, it add classes in two places. Here I wanted it:
<div id="edit-important-categories" class="form-radios radioTabs">
Here I didn't:
<input id="edit-important-categories-22" class="radioTabs form-radio" type="radio" value="22" name="important_categories">
On individual radio, I need radioTab
(singular, not plural), and on default one also radioTabDefault
.
Is there any built-in method to get this? Or do I need to alter my theme, like I did for labels? If so, what function I should modify?