In VBO enabled views, when each row has a checkbox, the checkbox is rendered without a <label for="xyz0"></label> label.

This works well as long as you use the normal checkboxes of your browser. If you use a CSS enabled custom checkbox, hiding the browser checkbox with display:none; and using a label::before attribute with a background image, this image is not shown at all because the label tag is not rendered at all.
My CSS theme ("Candidate") e.g. uses a input["checkbox]" + label CSS tag to address this label, so the label must be after the checkbox input.

This could be maybefixed IMHO by rendering that checkbox with an empty label tag after it.
Changing views/views_bulk_operations_handler_field_operations.inc, line 271 (for radios) and (afterwords) 279 (for checkboxes) with an added '#title' => ' ' apparently fixes the issue - but it renders a label with " " then, which maybe is not good.

Is there a way to tell Drupal te render an empty label?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nerdoc created an issue. See original summary.

nerdoc’s picture

This patch is just for testing purposes - it does not sufficently fix the issue.

nerdoc’s picture

Maybe this is not VBO's fault, but the theme's - BUT: there is no way that at least I can think of to display:none a checkbox and render another item instead of it, then there's no label...

BarisW’s picture

I worked around this in a project the following way:

<?php

/**
 * Implements hook_form_FORM_ID_alter().
 */
function MYMODULE_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) {
  $items = element_children($form['views_bulk_operations']);
  foreach ($items as $item) {
    $row = &$form['views_bulk_operations'][$item];

    // Set a label to style the checkbox.
    $row['#title'] = t('Select');
  }
}?>