Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brookinsconsulting/337265c55e4909119580fd2834e655a8 to your computer and use it in GitHub Desktop.
Save brookinsconsulting/337265c55e4909119580fd2834e655a8 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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
Copy link
Author

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