开发者

Define block delta from a renderable array via hook_page_alter

开发者 https://www.devze.com 2023-03-28 01:29 出处:网络
I am working at theme layer via hook_page_alter to insert a custom \"special_theme\" into the footer region without using block management, nor module:

I am working at theme layer via hook_page_alter to insert a custom "special_theme" into the footer region without using block management, nor module:

  $page['footer'][] = array(
    '#weight' => 10,
    '#theme' => 'special_theme',
    '#theme_wrappers' => array('block'),
    '#region' => 'footer',      
  ); 

The template is defined at hook_theme. The block is inserted into the footer region as I expected, but I need to define its block id or delta. Drupal automatically inserted id="block--2". I need to change "--2" into more readabl开发者_如何学Goe delta, such as "special_delta".

Is it possible with current drupal 7, and how? I may miss something obvious. Thanks for any help.


This is not possible with current drupal 7, I guess. Hopefully future drupal can define blocks via template layer. The hook_page_alter is already powerful. How can I close this question?

0

精彩评论

暂无评论...
验证码 换一张
取 消