OnBeforeGetSafeUrlPart removed in K13

CSS Team asked on March 10, 2021 12:57

I noticed that URLHelper.OnBeforeGetSafeUrlPart was removed in K13 (link). We used it to reformat vowels, e.g. ö to oe, ü to ue. Does anyone know how to accomplish this now?

Correct Answer

Liam Goldfinch answered on March 11, 2021 01:58

KX13 already handles diacritics out of the box in some scenarios (see here).

Like Dmitry has suggested you can hook into an event to handle it yourself, but you could also look at the OnBeforeRemoveDiacritics event mentioned in the documentation to change the default behaviour.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on March 10, 2021 16:30

Were you using this when creating new pages? If so, my best guess would be to amend the document name (as URL slug should be based on it) before inserting a new document, in a custom module:

protected override void OnInit()
{
    base.OnInit();

    DocumentEvents.Insert.Before += InsertOnBefore;
}

private void InsertOnBefore(object sender, DocumentEventArgs e)
{
    e.Node.DocumentName = e.Node.DocumentName.Replace("ö", "oe");
}

I haven't tested it myself, but hope it should work.

0 votesVote for this answer Mark as a Correct answer

CSS Team answered on March 11, 2021 18:22

Custom handling of diacritics it is then. I'll give it a try. Thanks!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.