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
69f9209e
Commit
69f9209e
authored
5 years ago
by
bgm
Committed by
bgm
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
hook_civicrm_permission: fix incorrect 'ts' usage.
parent
6ea80d4f
No related branches found
Branches containing commit
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_permission.md
+18
-16
18 additions, 16 deletions
docs/hooks/hook_civicrm_permission.md
with
18 additions
and
16 deletions
docs/hooks/hook_civicrm_permission.md
+
18
−
16
View file @
69f9209e
...
...
@@ -29,7 +29,7 @@ to grant it to users.
- Simple associative array in the format "permission string =>
label". Compatible with CiviCRM 4.3+.
$prefix = ts('CiviCRM Grant Program') . '
:
';
// name of extension or module
$prefix = ts('CiviCRM Grant Program
:
') . ' ';
$permissions['edit grant programs'] = $prefix . ts('edit grant programs');
$permissions['delete in Grant Program'] = $prefix . ts('delete grant program');
...
...
@@ -39,14 +39,14 @@ to grant it to users.
array item is present, it will appear as a description beneath
the permission.
$prefix = ts('CiviCRM Grant Program') . '
:
';
// name of extension or module
$permissions['edit grant programs'] =
array(
$prefix = ts('CiviCRM Grant Program
:
') . ' ';
$permissions['edit grant programs'] =
[
$prefix . ts('edit grant programs'), // label
ts('Create or edit grant programs and their criteria'), // description
)
;
$permissions['delete in Grant Program'] =
array(
]
;
$permissions['delete in Grant Program'] =
[
$prefix . ts('delete grant program'), // if no description, just give an array with the label
)
;
]
;
## Returns
...
...
@@ -66,26 +66,28 @@ permissions, so one should adopt unique permission names.
## Example
The following is an excerpt
from
[
the CiviCRM Monitoring for
The following is an excerpt
based on
[
the CiviCRM Monitoring for
Nagios
](
https://github.com/aghstrategies/com.aghstrategies.civimonitor/blob/bc1993fd07e2c730847e5fda6bf3958d41a51341/civimonitor.php#L132
)
extension, including a check for the CiviCRM version in order to ensure
backwards compatibility while providing a description to versions that
support it.
use CRM_Civimonitor_ExtensionUtil as E;
function civimonitor_civicrm_permission(&$permissions) {
$version = CRM_Utils_System::version();
if (version_compare($version, '4.6.1') >= 0) {
$permissions +=
array(
'access CiviMonitor' =>
array(
ts('Access CiviMonitor'
, array('domain' => 'com.aghstrategies.civimonitor')
),
ts('Grants the necessary API permissions for a monitoring user without Administer CiviCRM'
, array('domain' => 'com.aghstrategies.civimonitor')
),
)
,
)
;
$permissions +=
[
'access CiviMonitor' =>
[
E::
ts('Access CiviMonitor'),
E::
ts('Grants the necessary API permissions for a monitoring user without Administer CiviCRM'),
]
,
]
;
}
else {
$permissions +=
array(
'access CiviMonitor' => ts('Access CiviMonitor'
, array('domain' => 'com.aghstrategies.civimonitor')
),
)
;
$permissions +=
[
'access CiviMonitor' =>
E::
ts('Access CiviMonitor'),
]
;
}
}
...
...
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