function follow_contextual_links_view_alter in Follow 7.2
Same name and namespace in other branches
- 7 follow.module \follow_contextual_links_view_alter()
Implements hook_contextual_links_view_alter().
Parameters
$element: A renderable array representing the contextual links.
$items: An associative array containing the original contextual link items, as generated by menu_contextual_links(), which were used to build $element['#links'].
File
- ./
follow.module, line 417
Code
function follow_contextual_links_view_alter(&$element, $items) {
// Add the Follow configuration links to both of the Follow blocks.
$block = isset($element['#element']['#block']) ? $element['#element']['#block'] : NULL;
if (is_object($block) && $block->module == 'follow') {
$uid = arg(1);
if ($block->delta == 'site' && user_access('edit site follow links')) {
$element['#links']['follow-edit'] = array(
'title' => t('Edit Follow links'),
'href' => 'admin/config/services/follow',
'query' => drupal_get_destination(),
'attributes' => array(
'title' => t('Configure the site-wide web service follow links.'),
),
);
}
elseif ($block->delta == 'user' && follow_links_user_access($uid)) {
$element['#links']['follow-edit'] = array(
'title' => t('Edit Follow links'),
'href' => 'user/' . $uid . '/follow',
'query' => drupal_get_destination(),
'attributes' => array(
'title' => t('Update the associated web service follow links.'),
),
);
}
}
}