function power_menu_block in Power Menu 6
implementation of hook_block().
Parameters
$op:
$delta:
$edit:
File
- ./
power_menu.module, line 671 - This module provides some additional menu features. The features are not actually new, but are part of other modules. it's though very cumbersome to creating a new menu item, because one has to go to all the different places to configure these…
Code
function power_menu_block($op = 'list', $delta = 0, $edit = array()) {
$properties = power_menu_get_all_property_definitions();
$mlid = power_menu_get_mlid(check_plain($_GET['q']));
if (!$mlid && preg_match('|node/[0-9]*$|', $_GET['q'], $match)) {
$item = power_menu_node_location(node_load(arg(1)));
$mlid = power_menu_get_mlid($item['href']);
}
if ($op == 'list') {
foreach ($properties as $item) {
if ($item['scope'] == 'block') {
$blocks[$item['property_name']] = array(
'info' => 'Power Menu Block: ' . $item['property_name'],
'cache' => BLOCK_CACHE_PER_PAGE,
);
}
}
return $blocks;
}
else {
if ($op == 'view') {
include_once $properties[$delta]['path'] . '/' . $properties[$delta]['file'];
$block = array(
'content' => $properties[$delta]['property_load']($mlid),
'subject' => $properties[$delta]['title'],
);
return $block;
}
}
}