Skip to content
Snippets Groups Projects
Commit 3f3298e1 authored by Andie Hunt's avatar Andie Hunt
Browse files

hook_civicrm_managed: fixed formatting

parent 6bf706e4
No related branches found
No related tags found
No related merge requests found
...@@ -13,40 +13,50 @@ Installation](http://civicrm.org/blogs/totten/api-and-art-installation). ...@@ -13,40 +13,50 @@ Installation](http://civicrm.org/blogs/totten/api-and-art-installation).
## Definition ## Definition
hook_civicrm_managed(&$entities) ```php
hook_civicrm_managed(&$entities)
```
## Parameters ## Parameters
- array $entities - the list of entity declarations; each declaration - array `$entities` - the list of entity declarations; each declaration
is an array with these following keys:\ is an array with these following keys:
- 'module': string; for module-extensions, this is the
fully-qualifed name (e.g. "*com.example.mymodule*"); for Drupal - string `module` - for module-extensions, this is the
modules, the name is prefixed by "drupal" (e.g. fully-qualifed name (e.g. `com.example.mymodule`); for Drupal
*"drupal.mymodule*") modules, the name is prefixed by `drupal` (e.g.
- 'name': string, a symbolic name which can be used to track this `drupal.mymodule`)
- string `name` - a symbolic name which can be used to track this
entity (*Note: Each module creates its own namespace*) entity (*Note: Each module creates its own namespace*)
- 'entity': string, an entity-type supported by the [CiviCRM
- string `entity` - an entity-type supported by the [CiviCRM
API](https://wiki.civicrm.org/confluence/display/CRMDOC/API+Reference) (*Note: this API](https://wiki.civicrm.org/confluence/display/CRMDOC/API+Reference) (*Note: this
currently must be an entity which supports the 'is_active' currently must be an entity which supports the 'is_active'
property*) property*)
- 'params': array, the entity data as supported by the [CiviCRM
- array `params` - the entity data as supported by the [CiviCRM
API](https://wiki.civicrm.org/confluence/display/CRMDOC/API+Reference) API](https://wiki.civicrm.org/confluence/display/CRMDOC/API+Reference)
- 'update' (**v4.5+**): string, a policy which describes when to
- string `update` - a policy which describes when to
update records update records
- 'always' (**default**): always update the managed-entity
record; changes in $entities will override any local - `always` (**default**): always update the managed-entity
record; changes in `$entities` will override any local
changes (eg by the site-admin) changes (eg by the site-admin)
- 'never': never update the managed-entity record; changes - `never`: never update the managed-entity record; changes
made locally (eg by the site-admin) will override changes in made locally (eg by the site-admin) will override changes in
$entities `$entities`
- 'cleanup' (**v4.5+**): string, a policy which describes whether
to cleanup the record when it becomes orphaned (ie when - string `cleanup` - a policy which describes whether
$entities no longer references the record)\ to cleanup the record when it becomes orphaned (i.e. when
- 'always' (**default**): always delete orphaned records $entities no longer references the record)
- 'never': never delete orphaned records
- 'unused': only delete orphaned records if there are no other - `always` (**default**): always delete orphaned records
- `never`: never delete orphaned records
- `unused`: only delete orphaned records if there are no other
references to it in the DB. (This is determined by calling references to it in the DB. (This is determined by calling
the API's "getrefcount" action.) the API's `getrefcount` action.)
## Returns ## Returns
...@@ -54,21 +64,23 @@ Installation](http://civicrm.org/blogs/totten/api-and-art-installation). ...@@ -54,21 +64,23 @@ Installation](http://civicrm.org/blogs/totten/api-and-art-installation).
## Example ## Example
/** ```php
* Declare a report-template which should be activated whenever this module is enabled /**
*/ * Declare a report-template which should be activated whenever this module is enabled
function modulename_civicrm_managed(&$entities) { */
$entities[] = array( function modulename_civicrm_managed(&$entities) {
'module' => 'com.example.modulename', $entities[] = array(
'name' => 'myreport', 'module' => 'com.example.modulename',
'entity' => 'ReportTemplate', 'name' => 'myreport',
'params' => array( 'entity' => 'ReportTemplate',
'version' => 3, 'params' => array(
'label' => 'Example Report', 'version' => 3,
'description' => 'Longish description of the example report', 'label' => 'Example Report',
'class_name' => 'CRM_Modulename_Report_Form_Sybunt', 'description' => 'Longish description of the example report',
'report_url' => 'mymodule/mysbunt', 'class_name' => 'CRM_Modulename_Report_Form_Sybunt',
'component' => 'CiviContribute', 'report_url' => 'mymodule/mysbunt',
), 'component' => 'CiviContribute',
); ),
} );
\ No newline at end of file }
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment