The remove links currently include content such as parenthesis and a description of the relationship being altered. In some cases (such as in the Commons distribution) we want to simplify the text and markup here and present this button as a link. Simply styling the link isn't sufficient because the text describing the relationship is still present. As an example of this issue:

https://skitch.com/ezra-g/gdqps/bill-commons1

My initial thought was to add a configurable option to the settings for each relationship that make the description text optional in the unfollow links and then export the setting. However, since these settings are stored in {user_relationships}, adding a setting requires altering schema and I don't believe there is exportability of these settings.

As an alternative, let's make it possible to alter these links.

Here's a patch that defines a new hook_user_relationships_remove_link(), along with an example of how the Commons_core module would implement it to remove the undesired text:


/**
 * Implementation of hook_user_relationships_remove_link_alter().
 */
function commons_core_user_relationships_remove_link_alter(&$list, $args) {
  // Remove extra markup around the "remove" link so that it can be styled
  // as a button.
  foreach ($args[3] as $rid => $relationship) {
    // TODO: Consider having a constant for the relationship ID.
    if ($relationship->rtid == 1) {
      $list[$relationship->rid] = theme('user_relationships_remove_link', $args[0]->uid, $relationship->rid); 
    }
  }
}
CommentFileSizeAuthor
ur_alter_remove_links.patch1.54 KBezra-g
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, ur_alter_remove_links.patch, failed testing.

ezra-g’s picture

Status: Needs work » Needs review

Seems like the test-bot had an unrelated error trying to review this patch.

ezra-g’s picture

ur_alter_remove_links.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, ur_alter_remove_links.patch, failed testing.