You are here

function media_gallery_contextual_links_view_alter in Media Gallery 7

Same name and namespace in other branches
  1. 7.2 media_gallery.module \media_gallery_contextual_links_view_alter()

Implements hook_contextual_links_view_alter().

File

./media_gallery.module, line 1242

Code

function media_gallery_contextual_links_view_alter(&$element, $items) {

  // Modify the contextual links on gallery blocks; we only want to allow
  // editing the gallery and configuring the block, and we want a more
  // descriptive title for the edit link.
  if (isset($element['#element']['#block']->module) && $element['#element']['#block']->module == 'media_gallery' && !empty($element['#links'])) {
    $links =& $element['#links'];
    foreach ($links as $key => &$link) {
      if ($key != 'node-edit' && $key != 'block-configure') {
        unset($links[$key]);
      }
      elseif ($key == 'node-edit') {
        $link['title'] = t('Edit gallery');
      }
    }
  }
}