Attached is a patch that makes the global tokens provided by the token module available to the nodereference module in the advanced data settings in the field configuration form.

The change allows you to change which nodes are presented to the user contextually. I'm using it to allow users to reference only the nodes they created.

The patch introduces two simple changes to the 5.x-1.6-1 version of nodereference.module. It adds some help text to the field configuration form, and it adds the token_replace function to the processing of the arguments submitted by that form.

The patch applies to 5.x. I have no idea if it would be compatible with 4.7.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

WorldFallz’s picture

Version: 5.x-1.6-1 » 5.x-1.x-dev
FileSize
1.87 KB

rerolled patch against the current DRUPAL-5 branch. changed token delimiters to '[' and ']' to mimic the delimiters used by the viewfield module. Works as expected-- powerful extension to nodereference module.

yched’s picture

Status: Needs review » Closed (duplicate)

Please merge efforts into #196518: Token support for advanced view argument (patch for CCK D6, will be backported when the D6 version gets in)

noelbush’s picture

The patch in #1 did not go far enough for me, because it only provides access to "global" tokens (like site name). So the attached patch (against the latest Drupal 5 release of cck/nodereference) provides access to node information and fields.

Sorry, this is for Drupal 5 -- there are still a few of us using it. ;-)

betz’s picture

any drupal 6 version?
This is exactly what i need also

adam_b’s picture

unsubscribe - found duplicate ref