[ACA-1814] Documentation on extending the Content Metadata (#677)

This commit is contained in:
Suzana Dirla 2018-10-01 12:19:28 +03:00 committed by Denys Vuika
parent 22800c0e5a
commit 127dbc9ca4

View File

@ -30,6 +30,7 @@ You can create plugins that change, toggle or extend the following areas:
- toolbar entries
- buttons
- "More actions" buttons
- Content metadata presets (used on `Properties` tab)
Extensions can also:
@ -847,6 +848,7 @@ The ACA supports the following set of extension points:
- Context Menu
- Viewer
- Sidebar (aka Info Drawer)
- Content metadata presets (for `Properties` tab)
All the customisations are stored in the `features` section of the configuration file:
@ -867,7 +869,8 @@ All the customisations are stored in the `features` section of the configuration
"openWith": [],
"content": []
},
"sidebar": []
"sidebar": [],
"content-metadata-presets": []
}
}
```
@ -1361,6 +1364,112 @@ and invoke it from the custom `Open With` menu entry called `Snackbar`.
As with other content actions, custom plugins can disable, update or extend `Open With` actions.
### Content metadata presets
The content metadata presets are needed by the [Content Metadata Component](https://alfresco.github.io/adf-component-catalog/components/ContentMetadataComponent.html#readme) to render the properties of metadata aspects for a given node.
The different aspects and their properties are configured in the `app.config.json` file, but they can also be set on runtime through extension files.
Configuring these presets from `app.extensions.json` will overwrite the default application setting.
Settings them from custom plugins allows user to disable, update or extend these presets.
Check out more info about merging extensions [here](#merging-properties).
The `content-metadata-presets` elements can be switched off by setting the `disabled` property.
This can be applied also for nested items, allowing disabling down to aspect level.
<p class="tip">
In order to modify or disable existing entries, you need to know the id of the target element, along with its parents ids.
</p>
Your extensions can perform the following actions at runtime:
* Add new presets items
* Add new items to existing presets at any level
* Disable specific items down to the aspect level
* Modify any existing item based on id.
Regarding properties, you can either:
* add new properties to existing aspect, or
* redefine the properties of an aspect.
Check out this code snippet to see how you can overwrite the properties for `exif:exif` aspect from external plugin:
```json
{
"$schema": "../../../extension.schema.json",
"$version": "1.0.0",
"$name": "plugin1",
"features": {
"content-metadata-presets": [
{
"id": "app.content.metadata.custom",
"custom": [
{
"id": "app.content.metadata.customGroup",
"items": [
{
"id": "app.content.metadata.exifAspect",
"disabled": true
},
{
"id": "app.content.metadata.exifAspect2",
"aspect": "exif:exif",
"properties": [
"exif:orientation",
"exif:manufacturer",
"exif:model",
"exif:software"
]
}
]
}
]
}
]
}
}
```
This external plugin disables the initial `exif:exif` aspect already defined in the `app.extensions.json` and defines other properties for the `exif:exif` aspect.
Here is the initial setting from `app.extension.json`:
```json
...
"content-metadata-presets": [
{
"id": "app.content.metadata.custom",
"custom": [
{
"id": "app.content.metadata.customGroup",
"title": "APP.CONTENT_METADATA.EXIF_GROUP_TITLE",
"items": [
{
"id": "app.content.metadata.exifAspect",
"aspect": "exif:exif",
"properties": [
"exif:pixelXDimension",
"exif:pixelYDimension",
"exif:dateTimeOriginal",
"exif:exposureTime",
"exif:fNumber",
"exif:flash",
"exif:focalLength",
"exif:isoSpeedRatings",
"exif:orientation",
"exif:manufacturer",
"exif:model",
"exif:software"
]
}
]
}
]
}
]
...
```
<p class="tip">
In order to allow extending the content-metadata presets, the settings from `app.config.json` must be copied to the `app.extensions.json` and ids must be added to all its items.
Having ids would allow external plugins to extend the current setting.
</p>
## Registration
You can use `ExtensionService` to register custom components, authentication guards,