1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 14:16:46 +02:00

feat(fields): fix RoutableField logic

This commit is contained in:
Awilum
2020-10-18 14:31:23 +03:00
parent c5d4c4832a
commit f64a749eb9

View File

@@ -10,18 +10,18 @@ declare(strict_types=1);
if (flextype('registry')->get('flextype.settings.entries.fields.routable.enabled')) {
flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void {
if (flextype('entries')->getStorage('fetch_single.data.routable') == null) {
if (flextype('entries')->getStorage('fetch_single.data.routable') === null) {
flextype('entries')->setStorage('fetch_single.data.routable', true);
} else {
flextype('entries')->setStorage('fetch_single.data.routable', (bool) flextype('entries')->getStorage('create.data.routable'));
flextype('entries')->setStorage('fetch_single.data.routable', (bool) flextype('entries')->getStorage('fetch_single.data.routable'));
}
});
flextype('emitter')->addListener('onEntryCreate', static function (): void {
if (flextype('entries')->getStorage('create.data.routable') != null && is_bool(flextype('entries')->getStorage('create.data.routable'))) {
flextype('entries')->setStorage('create.data.routable', (bool) flextype('entries')->getStorage('create.data.routable'));
} else {
if (flextype('entries')->getStorage('create.data.routable') === null) {
flextype('entries')->setStorage('create.data.routable', true);
} else {
flextype('entries')->setStorage('create.data.routable', (bool) flextype('entries')->getStorage('create.data.routable'));
}
});
}