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 40b2300 commit b45a2cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
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.

## 2.0.1 - 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)!

## 2.0.0 - 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": "2.0.0",
"version": "2.0.1",
"keywords": [
"craft",
"cms",
Expand Down
1 change: 0 additions & 1 deletion src/SlugEqualsTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function init()
$toOverwrite = Craft::$app->request->getBodyParam(self::$inputName, "") === "1";
}
if (!$toOverwrite) return;

if (!$element->title) return;

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

0 comments on commit b45a2cc

Please sign in to comment.