Skip to main content
1 of 2
Reshma
  • 716
  • 1
  • 4
  • 18

How to remove custom block parent div's?

I have created custom block in my custom module. I have created block template file into module templates folder. Custom block content coming successfully as per given in block__MODULENAME__dummmy_xyz.tpl.php file. I have only added following code into my block tpl file:

<div class="wrapperDummy">Hello</div>

But it is coming with block parent div's, Block id and block-inner tag. I dont want to show those extra div's. Following is the hook_theme which I have in my module file:

/*
 * Implements hook_theme().
 */
function MODULENAME_theme($existing, $type, $theme, $path) {
    
    $items = array();

    $items['MODULENAME_dummmy_xyz_block_theme'] = array(
        'type' => 'theme',
        'path' => drupal_get_path('module', 'MODULENAME') . '/templates',
        'template' => 'block__MODULENAME__dummmy_xyz',
        'variables'  => array()
    );
    return $items;
}

I am rendering block into tpl using,

$block = block_load('MODULENAME','dummmy_xyz');
print drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));

Kindly guide me.

Reshma
  • 716
  • 1
  • 4
  • 18