Remove dashes in hashtags, and don't lowercase

References #24
This commit is contained in:
Oliver Davies 2020-09-04 19:45:30 +01:00
parent 9219d10137
commit 9b26d772a8
2 changed files with 6 additions and 10 deletions

View file

@ -75,11 +75,9 @@ class Post extends Node implements ContentEntityBundleInterface {
}
private function convertTermToHashtag(Term $tag): string {
$tagName = strtolower($tag->label());
$tagName = "#{$tagName}";
$tagName = str_replace(' ', '-', $tagName);
return $tagName;
return '#' . (new Collection(explode(' ', $tag->label())))
->map(fn(string $word): string => ucfirst($word))
->implode('');
}
}