Search code examples
drupaldrupal-6

Delete Drupal system blocks from the blocks listing page


Is there any way by which I could delete or at least hide the drupal system blocks from the blocks listing page as I have too many blocks in my site.I can't actually find the delete option for these system blocks.I would like to make the block listing page showing only those blocks that are related to my custom theme.Is there some method by which i could delete or hide these blocks rather than changing the status of these corresponding blocks in the blocks table.Hope someone could help me with this.


Solution

  • You can use block_admin_display_form for this in drupal 6.

    Sample code:

    // This will allow only blocks from block module.
    // Place this code inside your template.php
    function phptemplate_preprocess_block_admin_display_form(&$vars) {
      // List of modules which are allowed on the block page
      $show = array(
        'block',
      );
      // Scan through each disabled block entry and remove ones that aren't needed.
      foreach ($vars['block_listing']['-1'] as $key => $disabled) {
        $type = explode('_', $key);
        if (!in_array($type[0], $show)) {
          unset($vars['block_listing']['-1'][$key]);
        }
      }
    }