πŸ‡ΊπŸ‡ΈUnited States @reuven

Account created on 20 June 2016, over 8 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States reuven

Add custom class to every radio's elements
Show radio element inline

$radioOptions = [
'red'=>'Red',
'blue'=>'Blue',
'white'=>'White',
'black'=>'Black',
'orange'=>'Orange',
];
$form['custom_radios'] = [
'#type' => 'radios',
  // ...
  '#options' => $radioOptions,
];

foreach($radioOptions as $key=>$value) {
          $form['custom_radios'][$key] =  [
              '#wrapper_attributes' => [
                  'class' => [
                      'form-check-inline',
                      'custom_class'
                  ],
              ],
          ];
      }

Production build 0.71.5 2024