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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
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
Documentation
Docs
Developer Documentation
Commits
148dab94
Commit
148dab94
authored
7 years ago
by
Seamus Lee
Browse files
Options
Downloads
Patches
Plain Diff
Migrate CiviTest Examples for two hooks that still reference them
parent
09496f77
No related branches found
Branches containing commit
No related tags found
1 merge request
!373
Migrate CiviTest Examples for two hooks that still reference them
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/hooks/hook_civicrm_dashboard.md
+28
-17
28 additions, 17 deletions
docs/hooks/hook_civicrm_dashboard.md
docs/hooks/hook_civicrm_emailProcessorContact.md
+45
-1
45 additions, 1 deletion
docs/hooks/hook_civicrm_emailProcessorContact.md
with
73 additions
and
18 deletions
docs/hooks/hook_civicrm_dashboard.md
+
28
−
17
View file @
148dab94
...
@@ -25,20 +25,31 @@ used to add content to the dashboard page.
...
@@ -25,20 +25,31 @@ used to add content to the dashboard page.
-
the HTML to include in the dashboard
-
the HTML to include in the dashboard
## Example
## Example
```
php
function civitest_civicrm_dashboard( $contactID, &$contentPlacement ) {
function
civitest_civicrm_dashboard
(
$contactID
,
&
$contentPlacement
)
{
// REPLACE Activity Listing with custom content
// REPLACE Activity Listing with custom content
$contentPlacement = 3;
$contentPlacement
=
3
;
return array( 'Custom Content' => "Here is some custom content: $contactID",
$content
=
array
(
'Custom Table' => "
'Custom Content'
=>
"Here is some custom content:
$contactID
"
,
<table>
'Custom Table'
=>
"
<tr><th>Contact Name</th><th>Date</th></tr>
<table>
<tr><td>Foo</td><td>Bar</td></tr>
<tr><th>Contact Name</th><th>Date</th></tr>
<tr><td>Goo</td><td>Tar</td></tr>
<tr><td>Foo</td><td>Bar</td></tr>
</table>
<tr><td>Goo</td><td>Tar</td></tr>
",
</table>"
,
);
);
}
return
$content
;
}
Also check
[
Civitest Sample
```
Module
](
http://svn.civicrm.org/civicrm/branches/v2.2/drupal/civitest.module.sample
)
### CiviTest example
\ No newline at end of file
```
php
function
civitest_civicrm_dashboard_defaults
(
$availableDashlets
,
&
$defaultDashlets
){
$contactID
=
CRM_Core_Session
::
singleton
()
->
get
(
'userID'
);
$defaultDashlets
[]
=
array
(
'dashboard_id'
=>
3
,
'is_active'
=>
1
,
'column_no'
=>
1
,
'contact_id'
=>
$contactID
,
);
}
```
This diff is collapsed.
Click to expand it.
docs/hooks/hook_civicrm_emailProcessorContact.md
+
45
−
1
View file @
148dab94
...
@@ -44,4 +44,48 @@ This hook was first available in CiviCRM 4.1.0
...
@@ -44,4 +44,48 @@ This hook was first available in CiviCRM 4.1.0
## Example
## Example
See civitest.module.sample.
```
php
\ No newline at end of file
function
civitest_civicrm_emailProcessorContact
(
$email
,
$contactID
,
&
$result
)
{
require_once
'CRM/Utils/Mail/Incoming.php'
;
// first split the email into name and domain
// really simple, definitely wrong implementation
list
(
$mailName
,
$mailDomain
)
=
CRM_Utils_System
::
explode
(
'@'
,
$email
,
2
);
// we are doing all our checks based on mailDomain, so if empty
// return and let EmailProcessor do its own thing
if
(
empty
(
$mailDomain
))
{
return
;
}
define
(
'FILE_TO_ORG_ALWAYS_TAG'
,
'MyTag1'
);
$orgID
=
_civitest_find_org_with_tag
(
FILE_TO_ORG_ALWAYS_TAG
,
$mailDomain
);
if
(
$orgID
)
{
$result
=
array
(
'contactID'
=>
$orgID
,
'action'
=>
CRM_Utils_Mail_Incoming
::
EMAILPROCESSOR_OVERRIDE
,
);
return
;
}
// if we already have a match, we will
// return and let EmailProcessor do its own thing
if
(
$contactID
)
{
return
;
}
// Orgs with this tag will have same-domain emails filed on them only if it
// passes through the ALWAYS tag check without finding a match, AND it does
// not match an individual.
define
(
'FILE_TO_ORG_INDIVIDUAL_UNMATCHED_TAG'
,
'MyTag2'
);
$orgID
=
_civitest_find_org_with_tag
(
FILE_TO_ORG_INDIVIDUAL_UNMATCHED_TAG
,
$mailDomain
);
if
(
$orgID
)
{
$result
=
array
(
'contactID'
=>
$orgID
,
'action'
=>
CRM_Utils_Mail_Incoming
::
EMAILPROCESSOR_OVERRIDE
);
return
;
}
$result
=
array
(
'action'
=>
CRM_Utils_Mail_Incoming
::
EMAILPROCESSOR_CREATE_INDIVIDUAL
);
}
```
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