How to change drupal checkbox as html structure

,
Copy and paste the below code in your template.tpl.php file in theme folder

function theme_checkbox($variables) {
$element = $variables['element'];
$element['#attributes']['type'] = 'checkbox';
element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));

// Unchecked checkbox has #value of integer 0.
if (!empty($element['#checked'])) {
$element['#attributes']['checked'] = 'checked';
}
_form_set_class($element, array('form-checkbox'));

return '<input' . drupal_attributes($element['#attributes']) . ' />';
}

Change theme_checkbox with your theme-name for example your theme name is prohcj then change it to prohcj_checkbox

and add your html structure inside return value. Example need to add before checkbox follow below code.

return '<span><input' . drupal_attributes($element['#attributes']) . ' /></span>';

Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.