Well you could extend the item:added
event to then take the item name and update the title to have a formatted item name minus all the special characters.
You would need to do a check to ensure the item that you are adding has a field called Title
or else it would fail. This probably isn't the most efficient and elegant solution because you are basically calling this code on every item add event. You could alternatively choose extend the custom standard values tokens, such as $id
or $parentname
and create your own called $nameclean
.
To extend this token replacement, you would patch the Setting MasterVariablesReplacer
and set it to a class that you'll create that will just extend from the existing Sitecore.Data.MasterVariablesReplacer, Sitecore.Kernel.dll
. If you decompile the Sitecore.Kernel.dll you can see the original source to that dll. Then you can add an additional line to replace this new custom token that you created. Then all you would need to do is add to the Title field for your Template, to the StandardValues $nameclean
, and when your item is created from this template it will generate the name you seek.