index.md 643 Bytes
Newer Older
Shane A. Stillwell's avatar
Shane A. Stillwell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
---
title: "Drupal Auto Node Title for multiple nodereference"
id: 18
date: "2008-05-19T18:57:45-05:00"
tags: 
- Programming
---

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>
  <?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);
  ?>
</php>