Skip to content

Commit

Permalink
Use ElementHelper::generateSlug instead of StringHelper::slugify
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design authored and internetztube committed Feb 9, 2023
1 parent f1204b1 commit f57e3a4
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/SlugEqualsTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use craft\commerce\services\ProductTypes;
use craft\elements\Category;
use craft\elements\Entry;
use craft\helpers\StringHelper;
use craft\helpers\ElementHelper;
use craft\web\View;
use internetztube\slugEqualsTitle\assetBundles\ExcludeFromRewriteAssetBundle;
use internetztube\slugEqualsTitle\services\ElementStatusService;
Expand Down Expand Up @@ -41,13 +41,7 @@ public function init()
}
if (!$toOverwrite) return;

$slug = $element->title;
if (Craft::$app->getConfig()->getGeneral()->limitAutoSlugsToAscii) {
$slug = StringHelper::toAscii($slug, $element->site->language);
}
$slug = StringHelper::slugify($slug, '-', $element->site->language);

$element->slug = $slug;
$element->slug = ElementHelper::generateSlug($element->title, null, $element->site->language);
};

$afterSafeCallback = function(Event $event) {
Expand Down

0 comments on commit f57e3a4

Please sign in to comment.