function custompage_block in Custom Page 6
Generate custom blocks
@returns block HTML
Parameters
op the operation from the URL:
delta offset:
edit edited values if a config or save:
File
- ./
custompage.module, line 93 - Custom Page Module
Code
function custompage_block($op = 'list', $delta = 0, $edit = array()) {
$styled_pathes = _custompage_get_mappings();
if (!is_array($styled_pathes)) {
$styled_pathes = array();
}
if ($op == "list") {
$blocks = array();
foreach ($styled_pathes as $path) {
// only create callbacks for page-type components
if ($path->type != 'block') {
continue;
}
$blocks[$path->key] = array(
'info' => $path->title,
);
}
return $blocks;
}
else {
if ($op == 'view') {
$block = array();
foreach ($styled_pathes as $path) {
// only create callbacks for page-type components
if ($path->type != 'block') {
continue;
}
if ($delta == $path->key) {
$block = array(
'subject' => $path->title,
'content' => theme(custompage_prefix($path->key), FALSE),
);
}
}
return $block;
}
}
}