diff --git user_relationship_blocks/templates/user_relationships-foaf_block.tpl.php user_relationship_blocks/templates/user_relationships-foaf_block.tpl.php new file mode 100644 index 0000000..8fa888d --- /dev/null +++ user_relationship_blocks/templates/user_relationships-foaf_block.tpl.php @@ -0,0 +1,11 @@ + diff --git user_relationship_blocks/user_relationship_blocks.install user_relationship_blocks/user_relationship_blocks.install index b1e999a..1584a72 100644 --- user_relationship_blocks/user_relationship_blocks.install +++ user_relationship_blocks/user_relationship_blocks.install @@ -64,3 +64,13 @@ function user_relationship_blocks_update_6100() { return $ret; } +/** + * Implementation of hook_update_N(). + * feature: block for "people you might know" #239162 + * Rather than creating new blocks, _user_relationship_blocks_settings() + * updates existing blocks using drupal_write_record(). + */ +function user_relationship_blocks_update_6101() { + $ret = array(); + return $ret; +} diff --git user_relationship_blocks/user_relationship_blocks.module user_relationship_blocks/user_relationship_blocks.module index e738f1a..2078b00 100644 --- user_relationship_blocks/user_relationship_blocks.module +++ user_relationship_blocks/user_relationship_blocks.module @@ -83,6 +83,11 @@ function user_relationship_blocks_theme() { 'path' => drupal_get_path('module', 'user_relationship_blocks') .'/templates', 'template' => 'user_relationships-actions_block', ), + 'user_relationships_foaf_block' => array( + 'arguments' => array('account' => NULL, 'settings' => NULL) , + 'path' => drupal_get_path('module', 'user_relationship_blocks') .'/templates', + 'template' => 'user_relationships-foaf_block', + ), ); } @@ -97,6 +102,9 @@ function theme_user_relationship_block_subject($bid, $account, $rtid, $extra) { elseif ($bid == 'actions') { return t('Relationship actions'); } + elseif (strlen(strstr($bid, 'foaf')) > 0) { + return t('People you may know'); + } //one-way relationships need special wording depending on the direction //this implies that we're showing a single relationship, no need to check for UR_BLOCK_ALL_TYPES elseif ($extra == 'you_to_them') { @@ -217,7 +225,9 @@ function _user_relationship_blocks_form($block, $rtid, $extra, $bid) { */ function _user_relationship_blocks_view($block_type, $rtid, $extra, $bid) { global $user; - $is_my_block = ($block_type == UR_BLOCK_MY || $block_type == 'pending'); + $is_my_block = ($block_type == UR_BLOCK_MY || + $block_type == 'pending' || + $block_type == 'foaf'); if ($is_my_block && !$user->uid) { return; } @@ -235,7 +245,7 @@ function _user_relationship_blocks_view($block_type, $rtid, $extra, $bid) { } if (isset($account)) { - $add_to_string = in_array($block_type, array('pending', 'actions')) ? "_{$block_type}" : ''; + $add_to_string = in_array($block_type, array('pending', 'actions', 'foaf')) ? "_{$block_type}" : ''; return array( 'subject' => theme('user_relationship_block_subject', $bid, $account, $rtid, $extra), 'content' => theme("user_relationships{$add_to_string}_block", $account, $settings, $extra), @@ -269,6 +279,7 @@ PHP; function _user_relationship_blocks_list() { $my = UR_BLOCK_MY . UR_BLOCK_SEPARATOR; $usr = UR_BLOCK_USER . UR_BLOCK_SEPARATOR; + $foaf = "foaf" . 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), @@ -281,6 +292,7 @@ function _user_relationship_blocks_list() { foreach ($types as $type) { $my_delta = "{$my}{$type->rtid}"; $usr_delta = "{$usr}{$type->rtid}"; + $foaf_delta = "{$foaf}{$type->rtid}"; $extras = array('' => ''); @@ -295,6 +307,7 @@ function _user_relationship_blocks_list() { foreach ($extras as $token => $extra) { $block_types = array( "{$my_delta}{$token}" => t('My Relationships: @type @extra', array('@type' => $type->plural_name, '@extra' => $extra)), + "{$foaf_delta}{$token}" => t('My Relationships: @type of a @type @extra', array('@type' => $type->name, '@extra' => $extra)), "{$usr_delta}{$token}" => t('User Relationships: @type @extra', array('@type' => $type->plural_name, '@extra' => $extra)), ); foreach ($block_types as $bid => $title) {