This would save having to enter a title twice for a simple web link content type yet still be able to have a usable link title. Can this be done with the default value php code? Thanks.

Comments

dodorama’s picture

an alternative to the php code could be automatic node titles module.
This way you can hide the title field and autofill it with the link title

quicksketch’s picture

Status: Active » Closed (duplicate)

This is a duplicate of link token support: http://drupal.org/node/118255. This feature would allow you to make the title default to many different things, not just the node title.

quicksketch’s picture

Status: Closed (duplicate) » Active

Oh yes, this could also probably be done with the PHP code block. However, I'm not sure how to use that field yet :)

I'll leave this open if someone else has the answer.

echoz’s picture

This is what I've done, + it might be what the original poster is looking for.
My content type is set to use no title, then using a custom node template, I use the node title field to construct the link, like so:

<a href="<?php print $field_link[0]['url']; ?>"><?php print $title; ?></a>
netentropy’s picture

Can you show us exactly how that is done and what it looks like?

quicksketch’s picture

With the latest development version (soon to be version 1.6) you can combine link.module with token.module to set dynamic titles or URLs. Enable the token module, then configure the settings for your link field. Under the default value you can enter '[title]', which will automatically be replaced with the node title when the node is viewed.

quicksketch’s picture

Status: Active » Fixed
killes@www.drop.org’s picture

Status: Fixed » Closed (fixed)