This plugin automatically links german legal norms - dependency-free & GDPR-friendly, powered by php-gesetze
.
Use one of the following methods to install & use kirby3-gesetze
:
If you know your way around Git, you can download this plugin as a submodule:
git submodule add https://codeberg.org/S1SYPHOS/kirby3-gesetze.git site/plugins/kirby3-gesetze
composer require s1syphos/kirby3-gesetze
Quick demonstration:
This markdown text
content ..
This is a **simple** HTML text. It contains legal norms, like Art. 12 I GG and § 433 II BGB!
.. easily ..
# .. via `kirbytext()` ..
echo $page->text()->kt()
# .. or page method ..
echo $page->gesetzify($text);
# .. or field method ..
echo $page->text()->gesetzify();
.. becomes:
<p>
This is a <strong>simple</strong> HTML text. It contains legal norms, like <a href="https://www.gesetze-im-internet.de/gg/art_12.html" target="_blank">Art. 12 I GG</a> or <a href="https://www.gesetze-im-internet.de/bgb/__433.html" target="_blank">§ 433 II BGB</a>!
</p>
You may change certain options from your config.php
globally ('kirby3-gesetze.optionName'
):
Option | Type | Default | Description |
---|---|---|---|
'enabled' |
bool | false |
Enables kirbytext:after hook |
'allowList' |
array | [] |
Allowed template names |
'blockList' |
array | [] |
Blocked template names |
'attributes' |
array | [] |
Controls HTML attributes |
'validate' |
bool | true |
Enable/disable validation |
'title' |
string | 'full' |
Controls title attribute. Possible values: false , 'light' , 'normal' , 'full' |
'drivers.preferred ' |
string | 'gesetze' |
Preferred driver. Possible values: 'gesetze' , 'dejure' , 'buzer' , 'lexparency' |
'drivers.blockList ' |
array | [] |
Unallowed driver(s). Possible values: see drivers.preferred |
When enabling the plugin via kirby3-gesetze.enabled
, auto-linking is applied to all kirbytext()
/ kt()
calls, with two exceptions:
- If a page's
intendedTemplate()
name is allow(list)ed, this overrideskirby3-gesetze.enabled
beingfalse
- If a page's
intendedTemplate()
name is block(list)ed, this overrideskirby3-gesetze.enabled
beingtrue
Besides that, there are additional methods you can use:
There are several ways to do this, you can either use a standalone function, a page method or a field method:
Processes (valid) legal norms throughout given text
Same as gesetzify
Same as gesetzify
, but supports applying kt()
/ kti()
via $inline
option.
- Add tests
kirby3-gesetze
is based on php-gesetze
library. It is licensed under the MIT License, but using Kirby in production requires you to buy a license.
I'd like to thank everybody that's making great software - you people are awesome. Also I'm always thankful for feedback and bug reports :)