Skip to content

Commit

Permalink
Use DBText::create() to call ATT() instead of trying to use custom class
Browse files Browse the repository at this point in the history
  • Loading branch information
normann committed Dec 8, 2019
1 parent 966896c commit 37355c2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/extensions/MetaDescriptionFallbackExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,8 @@ public function getGeneralMetaDescription($dataObject = null)
// add a space to closing </p> to prevent bunching, strip all tags and replace multiple spaces with a single one
$metaDescription = preg_replace('/\s+/', ' ', strip_tags(trim(str_replace('</p>', '</p> ', $metaDescription))));

// call ATT() on an instance of DBText's family, preferablly the DBMarkdownText DB fieldtype which is known
// to address Markdown format by Chrometoaster
$className = class_exists('Chrometoaster\MarkdownEnabledText\FieldTypes\DBMarkdownText') ?
\Chrometoaster\MarkdownEnabledText\FieldTypes\DBMarkdownText::class : DBText::class;

return singleton($className)->setValue($metaDescription)->ATT();
// call ATT() on an instance of DBText
return DBText::create()->setValue($metaDescription)->ATT();
}


Expand Down

0 comments on commit 37355c2

Please sign in to comment.