Default display option should use link value if no title provided

Benjamin Melançon - January 14, 2008 - 03:14
Project:Link
Version:5.x-2.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

There is no option to display a link as a linked URL.

If no title is provided, the default display is... nothing at all.

It's probably best to make this part of the default display option: if there is no title provided (and it's an option not to let people fill out the title at all) then the display is a linked URL.

#1

Benjamin Melançon - March 12, 2008 - 15:49

There was a patch to provide this functionality, not as a fallback but as an explicit option:

Add field formatter 'Plain, as link'.

benjamin, Agaric Design Collective

#2

quicksketch - March 31, 2008 - 07:27
Status:active» postponed (maintainer needs more info)

This should already be the case. The following code is in place already, and works properly as the default formatter on my Drupal 5 installation:

<?php
 
// Build the link with the URL or email address as the title (max 80 characters).
 
else {
   
$display_url = $type == LINK_EMAIL ? str_replace('mailto:', '', $url) : url($url, $query, $fragment, TRUE);
    if (
$field['display']['url_cutoff'] && strlen($display_url) > $field['display']['url_cutoff']) {
     
$display_url = substr($display_url, 0, $field['display']['url_cutoff']) . "...";
    }
   
$output = l($display_url, $url, $attributes, $query, $fragment);
  }
?>

This is in the case that the title is empty. Perhaps there's something incorrect about the way field settings are handled. Could you list the configuration for the your particular link field, as well as the version of CCK and Drupal core you're using?

#3

quicksketch - June 5, 2008 - 19:09
Status:postponed (maintainer needs more info)» closed
 
 

Drupal is a registered trademark of Dries Buytaert.