mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
* reduce code duplication * reduce duplication, fix license headers * simplify code * typings fixes * update tests * minor fixes * markdown fixes * revert changes
46 lines
1.2 KiB
Markdown
46 lines
1.2 KiB
Markdown
---
|
|
Title: Registration
|
|
---
|
|
|
|
# Registration
|
|
|
|
You can use `ExtensionService` to register custom components, authentication guards,
|
|
rule evaluators, etc.
|
|
|
|
It is recommended to register custom content from within the module constructor.
|
|
In that case all plugins will be available right after the main application component is ready.
|
|
|
|
Update the main application module `app.module.ts`, or create your own module,
|
|
and use the following snippet to register custom content:
|
|
|
|
```ts
|
|
import { ExtensionsModule, ExtensionService } from '@alfresco/adf-extensions';
|
|
|
|
@NgModule({
|
|
imports: [ ExtensionsModule ],
|
|
declarations: [ MyComponent1, MyLayout ]
|
|
})
|
|
export class MyExtensionModule {
|
|
|
|
constructor(extensions: ExtensionService) {
|
|
extensions.setComponents({
|
|
'plugin1.components.my': MyComponent1,
|
|
'plugin1.layouts.my': MyLayout
|
|
});
|
|
|
|
extensions.setAuthGuards({
|
|
'plugin.auth': MyAuthGuard
|
|
});
|
|
|
|
extensions.setEvaluators({
|
|
'plugin1.rules.custom1': MyCustom1Evaluator,
|
|
'plugin1.rules.custom2': MyCustom2Evaluator
|
|
});
|
|
}
|
|
|
|
}
|
|
```
|
|
|
|
The Registration API is not limited to the custom content only.
|
|
You can replace any existing entries by replacing the values from your module.
|