You are here

function edit_link_link in Util 6.3

Implements hook_link().

File

contribs/edit_link/edit_link.module, line 11
Add an 'edit' link to nodes.

Code

function edit_link_link($type, $object, $teaser = FALSE) {
  static $ntypes;
  if ($type == 'node' && $teaser && node_access('update', $object)) {
    $objtype = 'post';
    if (variable_get('edit_link_type', 0)) {
      if (!isset($ntypes)) {
        $ntypes = node_get_types('names');
      }
      $objtype = $ntypes[$object->type];
    }
    return array(
      'util-edit-link' => array(
        'title' => t('Edit this @type', array(
          '@type' => $objtype,
        )),
        'href' => "node/{$object->nid}/edit",
        'attributes' => array(
          'title' => t('Edit this @type', array(
            '@type' => $object->type,
          )),
        ),
      ),
    );
  }
}