function _user_relationship_blocks_list in User Relationships 6
helper function user_relationship_blocks_block delegates to when $op == 'list'
2 calls to _user_relationship_blocks_list()
- user_relationship_blocks_block in user_relationship_blocks/
user_relationship_blocks.module - Implementation for hook_block
- _user_relationship_blocks_insert_defaults in user_relationship_blocks/
user_relationship_blocks.module - Update the table with default values This makes sure it's not writing over user defined settings
File
- user_relationship_blocks/
user_relationship_blocks.module, line 268 - User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217
Code
function _user_relationship_blocks_list() {
$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' => BLOCK_NO_CACHE,
),
$usr . UR_BLOCK_ALL_TYPES => array(
'info' => t('User Relationships: All relationships'),
'cache' => BLOCK_NO_CACHE,
),
'pending' => array(
'info' => t('My Pending Relationships'),
'cache' => BLOCK_NO_CACHE,
),
'actions' => array(
'info' => t('User Relationships: Actions'),
'cache' => BLOCK_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: @type @extra', array(
'@type' => $type->plural_name,
'@extra' => $extra,
)),
"{$usr_delta}{$token}" => t('User Relationships: @type @extra', array(
'@type' => $type->plural_name,
'@extra' => $extra,
)),
);
foreach ($block_types as $bid => $title) {
$blocks[$bid] = array(
'info' => $title,
'cache' => BLOCK_NO_CACHE,
);
}
}
}
return $blocks;
}