Merge pull request #685 from wilr/wilr-patch-1

Allow multibyte to be configured (fixes #605)
This commit is contained in:
Guy Sartorelli 2023-10-09 20:48:45 +13:00 committed by GitHub
commit 08e2bd38e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.
*
*
* @method Blog Blog()
*
* @property string $Title
@ -33,6 +32,8 @@ class BlogCategory extends DataObject implements CategorisationObject
*/
private static $table_name = 'BlogCategory';
private static bool $allow_urlsegment_multibyte = true;
/**
* @var array
*/

View File

@ -181,12 +181,7 @@ trait BlogObject
{
$increment = (int) $increment;
$filter = URLSegmentFilter::create();
// 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);
$filter->setAllowMultibyte($this->config()->get('allow_urlsegment_multibyte') ?? true);
$this->URLSegment = $filter->filter($this->Title);

View File

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