FIX: Allow multibyte to be configured (#605)

This commit is contained in:
Will Rossiter 2022-08-22 15:37:28 +12:00 committed by Will Rossiter
parent c05f704a34
commit 99d1063361
No known key found for this signature in database
GPG Key ID: 9CD50F87382CDF52
3 changed files with 5 additions and 7 deletions

View File

@ -7,7 +7,6 @@ use SilverStripe\ORM\DataObject;
/** /**
* A blog category for generalising blog posts. * A blog category for generalising blog posts.
* *
*
* @method Blog Blog() * @method Blog Blog()
* *
* @property string $Title * @property string $Title
@ -33,6 +32,8 @@ class BlogCategory extends DataObject implements CategorisationObject
*/ */
private static $table_name = 'BlogCategory'; private static $table_name = 'BlogCategory';
private static bool $allow_urlsegment_multibyte = true;
/** /**
* @var array * @var array
*/ */

View File

@ -181,12 +181,7 @@ trait BlogObject
{ {
$increment = (int) $increment; $increment = (int) $increment;
$filter = URLSegmentFilter::create(); $filter = URLSegmentFilter::create();
$filter->setAllowMultibyte($this->config()->get('allow_urlsegment_multibyte') ?? true);
// Setting this to on. Because of the UI flow, it would be quite a lot of work
// to support turning this off. (ie. the add by title flow would not work).
// If this becomes a problem we can approach it then.
// @see https://github.com/silverstripe/silverstripe-blog/issues/376
$filter->setAllowMultibyte(true);
$this->URLSegment = $filter->filter($this->Title); $this->URLSegment = $filter->filter($this->Title);

View File

@ -18,6 +18,8 @@ class BlogTag extends DataObject implements CategorisationObject
{ {
use BlogObject; use BlogObject;
private static bool $allow_urlsegment_multibyte = true;
/** /**
* Use an exception code so that attempted writes can continue on * Use an exception code so that attempted writes can continue on
* duplicate errors. * duplicate errors.