0

I am trying Boxes for first time instead of block, however. It is adding some wrapper DIVs. I usually use hook_preprocess_block() to remove them but it is not the case with Boxes

 function HOOK_preprocess_block(&$variables)
{
    switch ($variables['block']->region) {
        default:
            $variables['theme_hook_suggestions'][] = 'block__no_wrap';
            break;
    }
}

How to remove DIVs wrapper for Boxes? Thank you for any help

1

I have not tried Boxes myself, but looking at its code, it looks like they use a theme function to produce the markup for the boxes.

If you implement theme_boxes_box (found in boxes.admin.inc) in your own theme/module you can just copy the code from it and remove the markup you don't want.

/**
 * Overrides theme_boxes_box().
 */
function MYMODULE_boxes_box($variables) {
  $block = $variables['block'];

  $empty = '';

  // Box is empty
  if ((empty($block['title']) || ($block['title'] == '<none>') ) && empty($block['content'])) {

    // add a class to mark the box as empty
    $empty = ' box-empty';

    // show something if the block is empty but the user has the permission to edit it
    if (boxes_access_edit()) {
      $block['content'] = t('This box appears empty when displayed on this page. This is simply placeholder text.');
    }
    else {
      return;
    }
  }

  $output = "<div id='boxes-box-" . $block['delta'] . "' class='boxes-box" . (!empty($block['editing']) ? ' boxes-box-editing' : '') . $empty . "'>";
  $output .= '<div class="boxes-box-content">' . $block['content'] . '</div>';
  if (!empty($block['controls'])) {
    $output .= '<div class="boxes-box-controls">';
    $output .= $block['controls'];
    $output .= '</div>';
  }
  if (!empty($block['editing'])) {
    $output .= '<div class="box-editor">' . drupal_render($block['editing']) . '</div>';
  }
  $output .= '</div>';
  return $output;
}
  • That did it. Thank You p.s. I was altering registry from module, but hey! it does for you in theme/template.php – latvian Sep 22 '14 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.