function og_block in Organic groups 5.2
Same name and namespace in other branches
- 5.8 og.module \og_block()
- 5 og.module \og_block()
- 5.3 og.module \og_block()
- 5.7 og.module \og_block()
- 6.2 og.module \og_block()
- 6 og.module \og_block()
Implementation of hook_block().
File
- ./
og.module, line 2034
Code
function og_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0]['info'] = t('Group details');
// $blocks[1] used to be the album block. We do not change the numbers to not confuse people who update.
$blocks[2]['info'] = t('Group subscribers');
$blocks[3]['info'] = t('New groups');
// Now provided by og_views. Please don't reuse this number 4
// $blocks[4]['info'] = t('My groups');
$blocks[5]['info'] = t('Group notifications');
// Auto-enable the group blocks for fresh installations.
$blocks[0]['status'] = 1;
$blocks[0]['weight'] = -2;
$blocks[5]['status'] = 1;
$blocks[5]['weight'] = -1;
return $blocks;
}
elseif ($op == 'view') {
switch ($delta) {
case 0:
return og_block_details();
case 2:
return og_block_subscribers();
case 3:
return og_block_new();
case 5:
return og_block_notifications();
}
}
elseif ($op == 'configure') {
switch ($delta) {
case 2:
case 3:
return array(
'og_block_cnt' => array(
'#type' => 'textfield',
'#title' => t('Maximum number of items to show'),
'#default_value' => variable_get("og_block_cnt_{$delta}", 10),
'#size' => 5,
'#maxlength' => 255,
),
);
}
}
elseif ($op == 'save') {
switch ($delta) {
case 2:
case 3:
if (isset($edit['og_block_cnt'])) {
variable_set("og_block_cnt_{$delta}", $edit['og_block_cnt']);
}
break;
}
}
}