Jump to content

sanitizer->pageName generates invalid pagenames

Martin Muzatko

Recommended Posts

See gif:


When I use $sanitizer->pageName()  to sanitize a title as name, I get a different result from what processwire automatically replaces, when editing the name in the CMS.

I have to manually replace the dashes and even dots!

I would expect the name to be equal to the last segment of the pagepath.


Link to comment
Share on other sites

There's nothing invalid about the original page name in your gif. Adding the $beautify argument to $sanitizer->pageName() will give a result that is closer to the JS replacement that happens in the admin interface.

But I take your point that it would be useful to have a sanitizer option that is an exact match for the JS replacement.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...