When I make some changes inside hook_block in my .module file, I can't see the changes.

Is there a special way to tell drupal to reload(refresh) block information by reading again hook_block ?

Thanx

Comments

nevets’s picture

By default the information is not cached, so it depends on what you changed. If you changed what is displayed simply visiting a page with the block should show the change. Otherwise visit the block admin page.

jorje29’s picture

nevets,

I understand what you say, some things change with a simple reload of the page, But what if you have the code below ? I don't see any effect when I change any of the block attributes.

<?php
$block[0] = array(
      'info' => t('Title'),
      'weight' => 1,
      'status' => 1,
      'region' => 'content',
      'cache' => -1,
      'visibility' => 2,
      'custom' => 0,
      'pages' => '<?php //some php code which returns TRUE or FALSE ?>'
      );

      return $block;
?>
nevets’s picture

That is probably true since Drupal saves the settings for a block once it is saved/configured from the block administration page. You would need to delete the block from the blocks table.

jorje29’s picture

I agree, this is the way it's working. Does this mean that reads the code of hook_block once ?

Btw, how can I add the delete option next to my blocks, in blocks list, ( created by my module ) ? there is only "configure" option, right now.

Thanx nevets for replying

nevets’s picture

Re: "Does this mean that reads the code of hook_block once", no, but for the case of $op equals 'info', hook_block() returns the initial configuration values, after that they come from the saved values (remember users can change the configuration).

As for 'delete' that only applies to custom blocks added with 'add block'.

jorje29’s picture

Thanx nevets,

Can you be a bit more specific on " As for 'delete' that only applies to custom blocks added with 'add block'. " ?

What do you mean exactly ?

nevets’s picture

Only blocks added through the block administration page have the delete option.

jorje29’s picture

This means that whenever I make changes to my hook_block code above, I have to make them twice, also inside block administration page. Right ?

nevets’s picture

For the case where $op equals 'info', any changes would need to be made in both places.