is there a way to remove special characters by the alias of a resource on modx? My clients often write page titles titles with special characters that become like this url www.mysite.it / trdfèèàèfdà-èàììdsf
I wish that were the catatteri specili converititi or removed and that possible?
It should be possible with a plugin attached to OnBeforeDocFormSave.
You might try this:
<?php
function slugify($string) {
$string = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $string);
$string = preg_replace('/[-\s]+/', '-', $string);
return trim($string, '-');
$pageAlias = $resource->get('pagetitle');
$resource->set('alias', slugify($pageAlias));