From 0371acff89b14b9bdcb03e72fd9637e26e6b517c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 29 Jan 2017 11:07:42 -0500 Subject: Move English documentation to folder en_US --- doc/en_US/plugin-metadata.markdown | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 doc/en_US/plugin-metadata.markdown (limited to 'doc/en_US/plugin-metadata.markdown') diff --git a/doc/en_US/plugin-metadata.markdown b/doc/en_US/plugin-metadata.markdown new file mode 100644 index 00000000..49da0ac1 --- /dev/null +++ b/doc/en_US/plugin-metadata.markdown @@ -0,0 +1,42 @@ +Metadata +======== + +You can attach metadata for each project, task, user or for the whole application. +Metadata are custom fields, it's a key/value table. + +For example your plugin can store external information for a task or new settings for a project. +Basically that allow you to extend the default fields without having to create new tables. + +Attach metadata to tasks and remove them +------------------------ + +```php + +// Return a dictionary of metadata (keys/values) for the $task_id +$this->taskMetadataModel->getAll($task_id); + +// Get a value only for a task +$this->taskMetadataModel->get($task_id, 'my_plugin_variable', 'default_value'); + +// Return true if the metadata my_plugin_variable exists +$this->taskMetadataModel->exists($task_id, 'my_plugin_variable'); + +// Create or update metadata for the task +$this->taskMetadataModel->save($task_id, ['my_plugin_variable' => 'something']); + +// Remove a metadata from a project +$this->projectMetadataModel->remove($project_id, my_plugin_variable); +``` + +Metadata types +-------------- + +- TaskMetadata: `$this->taskMetadataModel` +- ProjectMetadata: `$this->projectMetadataModel` +- UserMetadata: `$this->userMetadataModel` +- Settings/Config: `$this->configModel` + +Notes +----- + +- Always prefix the metadata name with your plugin name -- cgit v1.2.3