Drupal Auto Node Title for multiple nodereference

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

This is for a site I’ve put together that has a node referencing multiple other nodes. Token doesn’t handle multiple values yet so I had to strike out and use standard PHP for this.

This is customized for my site, but the point is there.

<?php global $form_values; $node = (array)$form_values; foreach ($node[‘field_connected’] as $key => $value){ $z = $value[‘node_name’]; if(!empty($z)){ $x[] .= preg_replace(‘/ [nid:\d+]/‘,“,$z); } } return implode(’ - ‘, $x); ?>

Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. shanestillwell@gmail.com