Skip to content

Commit

Permalink
Fixed bug that occurred when title was empty
Browse files Browse the repository at this point in the history
  • Loading branch information
internetztube committed Jul 20, 2023
1 parent 92b0c60 commit 51eea25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Slug Equals Title Changelog
All notable changes to this project will be documented in this file.

## 1.3.6 - 2023-07-20
### Fixed
- Fixed bug that occurred when title was empty. [#19](https://github.com/internetztube/craft-slug-equals-title/issues/19) [#20](https://github.com/internetztube/craft-slug-equals-title/pull/20) Thank you [@jorisnoo](https://github.com/jorisnoo)!

## 1.3.5 - 2023-02-09
### Fixed
- Use `ElementHelper::generateSlug` instead of `StringHelper::slugify`. Thank you, [@engram-design](https://github.com/engram-design). [#18](https://github.com/internetztube/craft-slug-equals-title/pull/18)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "internetztube/craft-slug-equals-title",
"description": "This plugin makes sure that the slug is always the same as the title.",
"type": "craft-plugin",
"version": "1.3.5",
"version": "1.3.6",
"keywords": [
"craft",
"cms",
Expand Down
1 change: 1 addition & 0 deletions src/SlugEqualsTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function init()
$toOverwrite = Craft::$app->request->getBodyParam('slugEqualsTitle_shouldRewrite', "") === "1";
}
if (!$toOverwrite) return;
if (!$element->title) return;

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

0 comments on commit 51eea25

Please sign in to comment.