You are here

function cck_blocks_contextual_links_view_alter in CCK Blocks 7

Implements hook_contextual_links_view_alter().

@todo Support other entity_types than node with this logic.

File

./cck_blocks.module, line 275

Code

function cck_blocks_contextual_links_view_alter(&$element, &$items) {

  // Modify the contextual links to make them more intuitive.
  if (isset($element['#links']['cck-blocks-edit'])) {
    $element['#links']['cck-blocks-edit']['title'] = t('Edit Field');

    // We need a better way of calculating the fragment to skip the
    // user straight down to the field they want.
    $element['#links']['cck-blocks-edit']['fragment'] = drupal_html_id('edit-' . str_replace('_', '-', $element['#element']['#block']->field['#field_name']));
  }
  if (isset($element['#links']['cck-blocks-delete'])) {
    unset($element['#links']['cck-blocks-delete']);
  }
}