function user_relationship_blocks_block_info in User Relationships 7
helper function user_relationship_blocks_block delegates to when $op == 'list'
File
- user_relationship_blocks/
user_relationship_blocks.module, line 262 - User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217
Code
function user_relationship_blocks_block_info() {
$my = UR_BLOCK_MY . UR_BLOCK_SEPARATOR;
$usr = UR_BLOCK_USER . UR_BLOCK_SEPARATOR;
// return list of all blocks defined by the module
$blocks = array(
$my . UR_BLOCK_ALL_TYPES => array(
'info' => t('My Relationships: All relationships'),
'cache' => DRUPAL_NO_CACHE,
),
$usr . UR_BLOCK_ALL_TYPES => array(
'info' => t('User Relationships: All relationships'),
'cache' => DRUPAL_NO_CACHE,
),
'pending' => array(
'info' => t('My Pending Relationships'),
'cache' => DRUPAL_NO_CACHE,
),
'actions' => array(
'info' => t('User Relationships: Actions'),
'cache' => DRUPAL_NO_CACHE,
),
);
$types = user_relationships_types_load();
foreach ($types as $type) {
$my_delta = "{$my}{$type->rtid}";
$usr_delta = "{$usr}{$type->rtid}";
$extras = array(
'' => '',
);
if ($type->is_oneway) {
$extras = array(
//add a little explanation about one-way relationships
UR_BLOCK_SEPARATOR . 'you_to_them' => t('(You to Them, backward direction)'),
UR_BLOCK_SEPARATOR . 'them_to_you' => t('(Them to You, normal direction)'),
);
}
foreach ($extras as $token => $extra) {
$block_types = array(
"{$my_delta}{$token}" => t('My Relationships: @rel_name_plural @extra', array(
'@extra' => $extra,
) + user_relationships_type_translations($type)),
"{$usr_delta}{$token}" => t('User Relationships: @rel_name_plural @extra', array(
'@extra' => $extra,
) + user_relationships_type_translations($type)),
);
foreach ($block_types as $bid => $title) {
$blocks[$bid] = array(
'info' => $title,
'cache' => DRUPAL_NO_CACHE,
);
}
}
}
return $blocks;
}