Skip to content

Commit

Permalink
feat(fields): remove markdown parser from ParsersField, as it is plan…
Browse files Browse the repository at this point in the history
…ed to be decoupled #199
  • Loading branch information
Awilum committed Jul 30, 2021
1 parent 8f3e75d commit c89d34c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/flextype/Foundation/Entries/Fields/ParsersField.php
Expand Up @@ -15,26 +15,22 @@

function processParsersField(): void
{

if (entries()->registry()->get('fetch.data.cache.enabled') == null) {
$cache = false;
} else {
$cache = (bool) entries()->registry()->get('fetch.data.cache.enabled');
}

if (entries()->registry()->get('fetch.data.parsers') != null) {

foreach (entries()->registry()->get('fetch.data.parsers') as $parserName => $parserData) {
if (in_array($parserName, ['markdown', 'shortcode'])) {
if (in_array($parserName, ['shortcode'])) {
if (entries()->registry()->get('fetch.data.parsers.'.$parserName.'.enabled') === true) {
if (entries()->registry()->get('fetch.data.parsers.'.$parserName.'.fields') != null) {
if (is_array(entries()->registry()->get('fetch.data.parsers.'.$parserName.'.fields'))) {
foreach (entries()->registry()->get('fetch.data.parsers.'.$parserName.'.fields') as $field) {
if (! in_array($field, registry()->get('flextype.settings.entries.content.fields'))) {
if ($parserName == 'markdown') {
if (arrays(entries()->registry()->get('fetch.data'))->has($field)) {
entries()->registry()->set('fetch.data.'.$field,
parsers()->markdown()->parse(entries()->registry()->get('fetch.data.'.$field), $cache));
}
}
if (! in_array($field, registry()->get('flextype.settings.entries.fields'))) {
if ($parserName == 'shortcode') {
if (arrays(entries()->registry()->get('fetch.data'))->has($field)) {
entries()->registry()->set('fetch.data.'.$field,
Expand Down

0 comments on commit c89d34c

Please sign in to comment.