diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api-swimlane-procedures.markdown | 2 | ||||
-rw-r--r-- | doc/api-task-procedures.markdown | 138 | ||||
-rw-r--r-- | doc/plugin-hooks.markdown | 46 |
3 files changed, 184 insertions, 2 deletions
diff --git a/doc/api-swimlane-procedures.markdown b/doc/api-swimlane-procedures.markdown index c58e56c9..d7c1e28f 100644 --- a/doc/api-swimlane-procedures.markdown +++ b/doc/api-swimlane-procedures.markdown @@ -373,7 +373,7 @@ Response example: ## disableSwimlane -- Purpose: **Enable a swimlane** +- Purpose: **Disable a swimlane** - Parameters: - **project_id** (integer, required) - **swimlane_id** (integer, required) diff --git a/doc/api-task-procedures.markdown b/doc/api-task-procedures.markdown index 934b1e09..2897c81a 100644 --- a/doc/api-task-procedures.markdown +++ b/doc/api-task-procedures.markdown @@ -695,3 +695,141 @@ Response example: ] } ``` + +## getTaskMetadata + +- Purpose: **Get all metadata related to a task by task unique id** +- Parameters: + - **task_id** (integer, required) +- Result on success: **list of metadata** +- Result on failure: **empty array** + +Request example to fetch all the metada of a task: + +```json +{ + "jsonrpc": "2.0", + "method": "getTaskMetadata", + "id": 133280317, + "params": [ + 1 + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 133280317, + "result": [ + { + "metaKey1": "metaValue1", + "metaKey2": "metaValue2", + ... + } + ] +} +``` + +## getTaskMetadataByName + +- Purpose: **Get metadata related to a task by task unique id and metakey (name)** +- Parameters: + - **task_id** (integer, required) + - **name** (string, required) +- Result on success: **metadata value** +- Result on failure: **empty string** + +Request example to fetch metada of a task by name: + +```json +{ + "jsonrpc": "2.0", + "method": "getTaskMetadataByName", + "id": 133280317, + "params": [ + 1, + "metaKey1" + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 133280317, + "result": "metaValue1" +} +``` + +## saveTaskMetadata + +- Purpose: **Save/update task metadata** +- Parameters: + - **task_id** (integer, required) + - **array("name" => "value")** (array, required) +- Result on success: **true** +- Result on failure: **false** + +Request example to add/update metada of a task: + +```json +{ + "jsonrpc": "2.0", + "method": "saveTaskMetadata", + "id": 133280317, + "params": [ + 1, + { + "metaName" : "metaValue" + } + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 133280317, + "result": true +} +``` + +## removeTaskMetadata + +- Purpose: **Remove task metadata by name** +- Parameters: + - **task_id** (integer, required) + - **name** (string, required) +- Result on success: **true** +- Result on failure: **false** + +Request example to remove metada of a task by name: + +```json +{ + "jsonrpc": "2.0", + "method": "removeTaskMetadata", + "id": 133280317, + "params": [ + 1, + "metaKey1" + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 133280317, + "result": true +} +``` diff --git a/doc/plugin-hooks.markdown b/doc/plugin-hooks.markdown index 787c62df..444b76db 100644 --- a/doc/plugin-hooks.markdown +++ b/doc/plugin-hooks.markdown @@ -105,7 +105,7 @@ class Plugin extends Base { public function initialize() { - $this->hook->on('template:layout:css', 'plugins/Css/skin.css'); + $this->hook->on('template:layout:css', array('template' => 'plugins/Css/skin.css')); } } ``` @@ -115,6 +115,33 @@ List of asset Hooks: - `template:layout:css` - `template:layout:js` + +Reference hooks +--------------- + +Reference hooks are passing a variable by reference. + +Example: + +```php +$this->hook->on('formatter:board:query', function (\PicoDb\Table &query) { + $query->eq('color_id', 'red'); +}); +``` + +The code above will show only tasks in red on the board. + +List of reference hooks: + +| Hook | Description | +|--------------------------------------------|---------------------------------------------------------------| +| `formatter:board:query` | Alter database query before rendering board | +| `pagination:dashboard:task:query` | Alter database query for tasks pagination on the dashboard | +| `pagination:dashboard:subtask:query` | Alter database query for subtasks pagination on the dashboard | +| `model:task:creation:prepare` | Alter form values before to save a task | +| `model:task:modification:prepare` | Alter form values before to edit a task | + + Template Hooks -------------- @@ -126,6 +153,22 @@ Example to add new content in the dashboard sidebar: $this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/sidebar'); ``` +Example to attach a template with local variables: + +```php +$this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/sidebar', array( + 'variable' => 'foobar', +)); +``` + +Example to attach a template with a callable: + +```php +$this->template->hook->attach('template:dashboard:sidebar', 'myplugin:dashboard/sidebar', function($hook_param1, $hook_param2) { + return array('new_template_variable' => 'foobar'); // Inject a new variable into the plugin template +}); +``` + This call is usually defined in the `initialize()` method. The first argument is name of the hook and the second argument is the template name. @@ -161,6 +204,7 @@ List of template hooks: | `template:config:email` | Email settings page | | `template:config:integrations` | Integration page in global settings | | `template:dashboard:sidebar` | Sidebar on dashboard page | +| `template:dashboard:show` | Main page of the dashboard | | `template:export:sidebar` | Sidebar on export pages | | `template:import:sidebar` | Sidebar on import pages | | `template:header:dropdown` | Page header dropdown menu (user avatar icon) | |