1

I don't really understand what the point of the $mask variable that is passed to hook_civicrm_links is. Can anyone explain it to me?

PS I understand how to use the other variables and I might not need to use $mask (the examples in the docs don't) but I feel like I might be missing out on something ingenious here.

The docs say:

$links = the links array 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 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 tag.

  • class (optional): Any other CSS classes to apply to the tag (e.g. no-popup).

$mask = a bitmask that will fiter $links

So I am guessing it is something to do with permissions. A but of human friendly explanation with context and example would be much appreciated :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.