Sample output of an url field
Field widget of an url field
Field settings of an url field

A lightweight URL field that is intended to be used as the basis for Drupal 8's URL field type in #501434: Move Link/URL field type into core. This can also easily be used to replace Drupal 6 profile URL fields.

Dependencies

None

Features

  • External links only
  • Optional title support
  • Titles can be automatically fetched from the <title> value of the URL.
  • Widget with options to use title or URL as the link text, and trim length for long URLs or titles.
  • Token replacement of the title field on display.
  • API support for attributes for each URL field value (not exposed in the widget).

If you need more complex stuff like supporting internal links or targets, etc., then you can easily write more complex field widgets and formatters.

Recommended modules

  • Elements module if enabled, the default URL field widget will use the HTML5 'url' FAPI element.

Similar modules

  • Link field module is the established, community-supported link module. My goals for this project are to investigate a much lighter-weight field type solution for Drupal core rather than porting Link to Drupal 8. The amount of features and code that we would have to cut from the Link module to make it appropriate for core would have neutered the module, so I thought it best to investigate a simple and light field type for core, and then Link module could be free to expose more complex widget and formatters on top of the field type in core.

Project Information

Downloads