Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ezpublishplatform and ezplatform SlugConverter class to transform all urlalias(es) into lowecase (ezp v3 style)
<?php
/**
* File containing the BcLowerCaseUnderscoreUrlAliasSlugConverter class part of the BcLowerCaseUrlAliasBundle package.
*
* @copyright Copyright (C) Brookins Consulting. All rights reserved.
* @license For full copyright and license information view LICENSE and COPYRIGHT.md file distributed with this source code.
* @version //autogentag//
* @package BcLowerCaseUrlAliasBundle
*/
/**
* Source: http://share.ez.no/forums/ez-platform/urlalias-lowercase-transform-equivalent
*
* Instrucctions: change the class from parameters
*
* parameters:
* ezpublish.persistence.slug_converter.class: BrookinsConsulting\BcLowerCaseUrlAliasBundle\Core\Persistence\Legacy\Content\UrlAlias\BcLowerCaseUnderscoreUrlAliasSlugConverter
*
*/
namespace BrookinsConsulting\BcLowerCaseUrlAliasBundle\Core\Persistence\Legacy\Content\UrlAlias;
use eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter;
use eZ\Publish\Core\Persistence\TransformationProcessor;
class BcLowerCaseUnderscoreUrlAliasSlugConverter extends SlugConverter {
/**
* Creates a new URL slug converter.
*
* @param \eZ\Publish\Core\Persistence\TransformationProcessor $transformationProcessor
* @param array $configuration
*/
public function __construct(TransformationProcessor $transformationProcessor, array $configuration = array())
{
$this->configuration['transformationGroups']['urlalias']['commands'] =
array_merge($this->configuration['transformationGroups']['urlalias']['commands'], array(
'ascii_lowercase',
'cyrillic_lowercase',
'greek_lowercase',
'latin1_lowercase',
'latin-exta_lowercase',
'latin_lowercase',
)
);
$this->configuration['wordSeparatorName'] = 'underscore';
parent::__construct($transformationProcessor, $configuration);
}
}
?>
@brookinsconsulting

This comment has been minimized.

Copy link
Owner Author

brookinsconsulting commented Mar 9, 2017

Hello eZ Publish Platform Community!

We have made a slight modifications to the original version of this code contributed by Vincent Guyard to fix a documentation typo which for some users could cause usage confusion.

We hope to soon integrate this code into a stand alone bundle which we hope will increase it's usability out of the box.

Cheers,
Brookins Consulting

@brookinsconsulting

This comment has been minimized.

Copy link
Owner Author

brookinsconsulting commented Mar 10, 2017

Hello eZ Publish Platform Community!

We have completed many significant improvements to the above static php gist code and packaged the entire solution.

This Gist is now deprecated. We strongly recommend you download and use our new feature complete (usable out of the box) bundle:

We hope these improvements help other users!

Cheers,
Brookins Consulting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.