Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brienne
Developer Documentation
Commits
e031528a
Commit
e031528a
authored
8 years ago
by
Andie Hunt
Browse files
Options
Downloads
Patches
Plain Diff
hook_civicrm_links: fix list and code examples
parent
9e97b386
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/hooks/hook_civicrm_links.md
+21
-12
21 additions, 12 deletions
docs/hooks/hook_civicrm_links.md
with
21 additions
and
12 deletions
docs/hooks/hook_civicrm_links.md
+
21
−
12
View file @
e031528a
...
...
@@ -30,21 +30,29 @@ hook_civicrm_links($op, $objectName, $objectId, &$links, &$mask, &$values)
-
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).
...
...
@@ -60,7 +68,7 @@ hook_civicrm_links($op, $objectName, $objectId, &$links, &$mask, &$values)
## Examples
```
php
function
MODULENAME_civicrm_links
(
$op
,
$objectName
,
$objectId
,
&
$links
,
&
$mask
,
&
$values
)
{
function
MODULENAME_civicrm_links
(
$op
,
$objectName
,
$objectId
,
&
$links
,
&
$mask
,
&
$values
)
{
$myLinks
=
array
();
switch
(
$objectName
)
{
case
'Contact'
:
...
...
@@ -89,11 +97,12 @@ function MODULENAME_civicrm_links( $op, $objectName, $objectId, &$links, &$mask,
case
'create.new.shorcuts'
:
// add link to create new profile
$links
[]
=
array
(
'url'
=>
'/civicrm/admin/uf/group?action=add&reset=1'
,
'name'
=>
ts
(
'New Profile'
),
// old extensions using 'title' will still work
);
break
;
$links
[]
=
array
(
'url'
=>
'/civicrm/admin/uf/group?action=add&reset=1'
,
'name'
=>
ts
(
'New Profile'
),
// old extensions using 'title' will still work
);
break
;
}
}
return
$myLinks
;
...
...
@@ -104,7 +113,7 @@ Adding contextual links to the rows of a contact's Events tab and Find
Participants search result
```
php
function
mymodule_civicrm_links
(
$op
,
$objectName
,
$objectId
,
&
$links
,
&
$mask
,
&
$values
)
{
function
mymodule_civicrm_links
(
$op
,
$objectName
,
$objectId
,
&
$links
,
&
$mask
,
&
$values
)
{
//create a Send Invoice link with the context of the participant's order ID (a custom participant field)
switch
(
$objectName
)
{
case
'Participant'
:
...
...
@@ -129,11 +138,11 @@ function mymodule_civicrm_links( $op, $objectName, $objectId, &$links, &$mask, &
}
$links
[]
=
array
(
'name'
=>
ts
(
'Send Invoice'
),
'title'
=>
ts
(
'Send Invoice'
),
'url'
=>
'civicrm/activity/email/add'
,
'qs'
=>
"action=add&reset=1&cid=
$cid
&selectedChild=activity&atype=3&order_id=
$order_id
"
);
'name'
=>
ts
(
'Send Invoice'
),
'title'
=>
ts
(
'Send Invoice'
),
'url'
=>
'civicrm/activity/email/add'
,
'qs'
=>
"action=add&reset=1&cid=
$cid
&selectedChild=activity&atype=3&order_id=
$order_id
"
,
);
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment