如何在Drupal 7中覆盖块布局?

时间:2013-09-27 10:29:26

标签: drupal module block

我正在使用simplenews模块来发布多个订阅 simplenews模块提供了一个块部分,但我需要改变设计的布局。

1 个答案:

答案 0 :(得分:1)

这是“function template_preprocess_block(& $ variables)”

的代码的一部分
  $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->region;
  $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module;
  // Hyphens (-) and underscores (_) play a special role in theme suggestions.
  // Theme suggestions should only contain underscores, because within
  // drupal_find_theme_templates(), underscores are converted to hyphens to
  // match template file names, and then converted back to underscores to match
  // pre-processing and other function names. So if your theme suggestion
  // contains a hyphen, it will end up as an underscore after this conversion,
  // and your function names won't be recognized. So, we need to convert
  // hyphens to underscores in block deltas for the theme suggestions.
  $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module . '__' . strtr($variables['block']->delta, '-', '_');

您可以在主题中创建一些.tpl文件,或者只是主题中的基本block.tpl.php