本文整理汇总了PHP中Block::add_to_area方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::add_to_area方法的具体用法?PHP Block::add_to_area怎么用?PHP Block::add_to_area使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::add_to_area方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_theme_activated
/**
* Add the K2 menu block to the nav area upon theme activation if there's nothing already there
*/
public function action_theme_activated()
{
$blocks = $this->get_blocks('nav', 0, $this);
if (count($blocks) == 0) {
$block = new Block(array('title' => _t('K2 Menu'), 'type' => 'k2_menu'));
$block->add_to_area('nav');
Session::notice(_t('Added K2 Menu block to Nav area.'));
}
}
示例2: action_theme_activated
/**
* On theme activation, activate some default blocks
*/
public function action_theme_activated()
{
$blocks = $this->get_blocks('primary', '', $this);
if (count($blocks) == 0) {
$block = new Block(array('title' => _t('Posts'), 'type' => 'grayposts'));
$block->add_to_area('primary');
Session::notice(_t('Added default blocks to theme areas.'));
}
}