forked from GNUsocial/gnu-social
[DOCS][Developer] Elaborate on implementing and configuring a module
This commit is contained in:
30
docs/developer/src/modules/configuration.md
Normal file
30
docs/developer/src/modules/configuration.md
Normal 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.
|
26
docs/developer/src/modules/lifetime.md
Normal file
26
docs/developer/src/modules/lifetime.md
Normal 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;
|
||||
}
|
||||
```
|
1
docs/developer/src/modules/sample_plugins/Awesomeness.md
Normal file
1
docs/developer/src/modules/sample_plugins/Awesomeness.md
Normal file
@@ -0,0 +1 @@
|
||||
# Awesomeness
|
0
docs/developer/src/modules/sample_plugins/Sample.md
Normal file
0
docs/developer/src/modules/sample_plugins/Sample.md
Normal file
Reference in New Issue
Block a user