I'm using the Link module to add a URL/link/website field to CCK content types. In the field's "default value" I have a Wikipedia article prefix (http://en.wikipedia.org/wiki/) and I would like to have the title of whatever node is being added to (like, say, the name of a game in the "title" field) to automatically appear at the end of that default value URL prefix. Is this possible to do automatically as soon as the content type's title is entered (like, say, after the "name"/title field loses focus)? For a "year" pull-down, I tried to get the current year as the default value by entering PHP code for getting the current year:

=date("Y");

...but it didn't work. I don't understand what it means by:

Expected format : array( 0 => array('url' => ..., 'title' => ..., 'attributes' => ...), 1 => ...).

Any help would be appreciated.

Comments

Eep²’s picture

I'd also like to put this in my site's footer so I don't have to change the date of the copyright every year.

mgifford’s picture

I was struggling with this too and frankly it wouldn't be too hard to provide a better default example. You want something you can just plunk in and it will work like:
return array(array('value' => 'Hello World'));

But in your case you want the date, so you'd want to put in:
return array(array('value' => date("Y")));

Now I haven't tried this specifically with the Link module (or indeed with the date). But this should work fine.

The problem is that different cck node types have different types of ways of specifying the defaults.
--
OpenConcept | SEO | Tech | Screencasts

gmclelland’s picture

Hey guys,

I was trying to figure out how to do the same thing at http://drupal.org/node/174555.

Any possibility that any of you could help me out.

Thanks,
Glenn