Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 406 characters in body
Source Link
Reshma
  • 716
  • 1
  • 4
  • 18

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))));

block.tpl.php code:

<?php print $outer_prefix . $inner_prefix; ?>
  <?php print render($title_prefix); ?>

  <?php if ($title): ?>
    <h2<?php print $title_attributes; ?>><?php print $title; ?></h2>
  <?php endif; ?>

  <?php print $content_processed; ?>

  <?php print render($title_suffix); ?>
<?php print $inner_suffix . $outer_suffix; ?>

Kindly guide me.

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.

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))));

block.tpl.php code:

<?php print $outer_prefix . $inner_prefix; ?>
  <?php print render($title_prefix); ?>

  <?php if ($title): ?>
    <h2<?php print $title_attributes; ?>><?php print $title; ?></h2>
  <?php endif; ?>

  <?php print $content_processed; ?>

  <?php print render($title_suffix); ?>
<?php print $inner_suffix . $outer_suffix; ?>

Kindly guide me.

Source Link
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.