[DOCS][Developer] Elaborate on implementing and configuring a module

This commit is contained in:
2021-08-22 19:58:48 +01:00
committed by Hugo Sales
parent 141f919ca7
commit 1ee8df1494
15 changed files with 151 additions and 20 deletions

View File

@@ -0,0 +1,30 @@
# Adding configuration to a Module
## The trade-off between re-usability and usability
> The more general the interface, the greater the re-usability, but it is then more
> complex and hence less usable.
It is often good to find a compromise by means of configuration.
## Module configuration
The default configuration is placed in `local/plugins/Name/config.yaml`.
```yaml
parameters:
name:
setting: 42
```
A user can override this configuration in `social.local.yaml` with:
```yaml
parameters:
locals:
name:
setting: 1337
```
Note that if plugin's name is something like `FirstSecond`, it will become `first_second`
in the configuration file.

View File

@@ -0,0 +1,26 @@
Initialization
--------------
Plugins overload this method to do any initialization they need, like connecting
to remote servers or creating paths or so on. @return bool hook value; true
means continue processing, false means stop.
```php
public function initialize(): bool
{
return true;
}
```
Clean Up
--------
Plugins overload this method to do any cleanup they need, like disconnecting from
remote servers or deleting temp files or so on.
```php
public function cleanup(): bool
{
return true;
}
```

View File

@@ -0,0 +1 @@
# Awesomeness