Skip to content

Commit

Permalink
Fixed slug based on title
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Leveille committed Jan 23, 2023
1 parent 54e9dec commit acd3796
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
4 changes: 0 additions & 4 deletions modules/site/services/CategoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public function beforeSaveHandler(ModelEvent $event): void
/** @var Category $category */
$category = $event->sender;

if (ElementHelper::isDraftOrRevision($category)) {
return;
}

// Update the slug based on category title
if ($category->title) {
$category->slug = ElementHelper::generateSlug((string) $category->title);
Expand Down
6 changes: 1 addition & 5 deletions modules/site/services/EntryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ public function beforeSaveHandler(ModelEvent $event): void
/** @var Entry $entry */
$entry = $event->sender;

if (ElementHelper::isDraftOrRevision($entry)) {
return;
}

// Update the slug based on entry title
if ($entry->title && $entry->getSection()->type != 'single') {
if ($entry->title && $entry->getSection()->type !== 'single') {
$entry->slug = ElementHelper::generateSlug((string) $entry->title);
}
}
Expand Down

0 comments on commit acd3796

Please sign in to comment.