Skip to content

Commit

Permalink
FIX Validate Category / Tag Titles
Browse files Browse the repository at this point in the history
  • Loading branch information
freezernick committed Jan 31, 2023
1 parent 6c0ae1f commit b75479a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Model/BlogCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ class BlogCategory extends DataObject implements CategorisationObject
'BlogPosts' => BlogPost::class,
];

public function validate()
{
$result = parent::validate();

if(empty($this->Title)) {
$result->addError(_t(__CLASS__ . '.TitleNotEmpty', 'Title must not be empty'));
}

return $result;
}

/**
* {@inheritdoc}
*/
Expand Down
11 changes: 11 additions & 0 deletions src/Model/BlogTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ class BlogTag extends DataObject implements CategorisationObject
'BlogPosts' => BlogPost::class
];

public function validate()
{
$result = parent::validate();

if(empty($this->Title)) {
$result->addError(_t(__CLASS__ . '.TitleNotEmpty', 'Title must not be empty'));
}

return $result;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit b75479a

Please sign in to comment.