This question already has an answer here:
Use case: Custom module to alter
CONTENTTYPE_node_forms to hide some of many entity reference options when adding/editing a node. Then via a custom validate I set $
form_state['values']['path']['pathauto'] = 0 and want to set the
$form_state['values']['path']['alias'] depending on the parent item of the chosen entity reference since unfortunately Pathauto doesn't provide tokens for that. Finally the alias should look like that:
I builded that pattern by hand now and I'm asking me after I couldn't find anything, if I also have to rebuild the whole
preg_replace pattern of Pathauto or if there's a way to reuse the same pattern Pathauto is using for replacing spaces, special characters etc.?
Or is there maybe any other intelligent alternative to set a path alias pattern like that?