从块列表页面删除Drupal系统块

时间:2013-08-20 05:55:49

标签: drupal drupal-6

我有delete或至少hide来自drupal system blocks页面的blocks listing,因为我的blocks太多了delete site.I实际上找不到这些system blocks的{​​{1}}选项。我想让block listing页面只显示与我blocks相关的custom theme 1}}。是否有一些方法可以delete or hide这些块而不是更改status中这些相应块的blocks table。希望有人可以帮助我。

2 个答案:

答案 0 :(得分:1)

你为什么要删除它们?理想情况下,只有管理员才能访问配置位置以触摸该列表。

如果你真的有,可以在自定义模块中实现这个钩子hook_block_list_alter。

https://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_list_alter/7

答案 1 :(得分:1)

您可以在drupal 6中使用block_admin_display_form

示例代码:

// 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]);
    }
  }
}