Skip to content

Commit

Permalink
Support taxonomies in title_format and excerpt_format
Browse files Browse the repository at this point in the history
  • Loading branch information
bobdenotter committed Sep 9, 2020
1 parent 14e46fb commit 9e73151
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Utils/ContentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ function ($match) use ($record, $locale) {
return $field;
}

if ($record->hasTaxonomyDefined($match[1])) {
$result = [];
foreach ($record->getTaxonomies($match[1]) as $item) {
$result[] = $item->getName();
}

return implode(', ', $result);
}

// We must ensure this method is not called recursively. For example
// `title_format: {title}` would otherwise result in an endless loop
// @see https://github.com/bolt/core/issues/1825
Expand Down

0 comments on commit 9e73151

Please sign in to comment.