-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto generated alias converts some special characters to numbers #1334
Comments
|
Could you please check if replacing line
$varValue = System::getContainer()->get('contao.slug.generator')->generate(html_entity_decode(StringUtil::stripInsertTags($dc->activeRecord->title)), $slugOptions); |
|
Yes, that solves the issue. |
|
However, shouldn't something like html_entity_decode(StringUtil::stripInsertTags(…))in every The old
|
|
The correct order should be:
As suggested in #1016 (comment) should we an optional parameter to |
|
Can't we put that into a service? This would imho make it easier for extensions to adapt. |
|
How should it be called |
|
Well, why not |
|
if we introduce a contao specific class we should stick to contao terminology: AliasGenerator (which internally uses @ausi's slug generator) |
|
We cannot remove the
Why would the current service not be used anymore? Creating slugs without the whole striptags and PageModel stuff still makes sense to me. |
Can we not decorate it? |
|
We can. We could also replace the service with our own class that extends |
|
is there an interface for your SlugGenerator? |
|
No. |
|
As discussed in the developer's meeting, this is what we want: // tl_form_field.php
public function generateAlias($varValue, DataContainer $dc)
{
$autoAlias = false;
// Generate an alias if there is none
if ($varValue == '')
{
$autoAlias = true;
$slugOptions = array();
// Read the slug options from the associated page
if (($objPage = PageModel::findWithDetails($dc->activeRecord->jumpTo)) !== null)
{
$slugOptions = $objPage->getSlugOptions();
}
$varValue = System::getContainer()->get('contao.slug.generator')->generate(StringUtil::prepareSlug($dc->activeRecord->title), $slugOptions);
}New methods:
The
|
|
Implemented in 9d7bdf4. |
Reproduction:
Newsletter Anmeldung (de).The auto generated alias will be
newsletter-anmeldung-40-de-41.Note: only some characters will actually be converted. For instance, the alias
!"§$%&/()=?will be converted to40-41-61.The text was updated successfully, but these errors were encountered: