I have to use the eZURLAliasFilterAppendNodeID class, which modify the url_alias of all the nodes from the given classes and append their node_id at the end.
The matter is that I need to append the date of the node's creation too and it seems that neither eZURLAliasFilterAppendNodeID and ezURLAlias do the job.
Does someone see a way to do that, please ? I haven't found any class which could, but I don't really want to add some code in my system classes... :-S
Thank's !
-- John
If you have a look at the default site.ini file :
# List of active filters, each entry must contain the name of the class
# which implements the filtering.
# DEPRECATED, use FilterClasses instead
Filters[]
# List of classes you want to call as an eZURLALiasFilter
FilterClasses[]
FilterClasses[]=eZURLAliasFilterAppendNodeID
This basically means that you can develop your own filter since eZ Publish lets you tell him what PHP classes are called when generating an URL :
class eZURLAliasFilterAppendDate extends eZURLAliasFilter
{
public function __construct() {}
public function process( $text, &$languageObject, &$caller )
{
if( !$caller instanceof eZContentObjectTreeNode )
{
eZDebug::writeError( 'The caller variable was not an eZContentObjectTreeNode', __METHOD__ );
return $text;
}
$separator = eZCharTransform::wordSeparator();
$publishedTimestamp = $caller->attribute( 'object' )->attribute( 'published' )
$formattedDate = ....
$text .= $separator . $formattedDate;
return $text;
}
}
Note : you might have to implement the same test on the class_identifier that is done in eZURLAliasFilterAppendNodeID
if you don't want to choose which content classes will be concerned
probably in settings/siteaccess/yourfrontendsite/site.ini.append.php
[URLTranslator]
FilterClasses[]=eZURLAliasFilterAppendDate
php bin/php/ezpgenerateautoloads.php -e