Skip to content
Snippets Groups Projects
hook_civicrm_links.md 4.75 KiB

hook_civicrm_links

Description

This hook is an opportunity to modify action links in CiviCRM. These include the actions at the end of a search result row, the Create New dropdown, and the Actions dropdown at the top of a contact record.

Note: remember to use the string processing functions of your host framework ( ts() for CiviCRM extensions, t() for Drupal modules, etc).

Definition

hook_civicrm_links($op, $objectName, $objectId, &$links, &$mask, &$values)

Parameters

  • string $op - the context in which the links appear, such as view.contact.activity, survey.dashboard.row, or pdfFormat.manage.action

  • string $objectName - the entity the links relate to (or NULL if $op is create.new.shorcuts)

  • int $objectId - the CiviCRM internal ID of the entity (or NULL if $op is create.new.shorcuts)

  • array $links - the links to modify in place

    each item in the array may have:

    • name: the link text
    • url: the link URL base path (like civicrm/contact/view, and fillable from $values)
    • qs: the link URL query parameters to be used by sprintf() with values (like `reset=1&cid=%%id%%` when `values['id']` is the contact ID)
    • title (optional): the text that appears when hovering over the link
    • extra (optional): additional attributes for the <a> tag (fillable from $values)
    • bit (optional): a binary number that will be fitered by mask (sending nothing as `links['bit']` means the link will always display)
    • ref (optional, recommended): a CSS class to apply to the <a> tag.
    • class (optional): Any other CSS classes to apply to the <a> tag (e.g. no-popup).
  • int $mask - a bitmask that will fiter $links

  • array $values - values to fill $links['url'], $links['qs'], and/or $links['extra'] using sprintf()-style percent signs

Returns

  • NULL