Commit 0a6d5808 authored by Nathan Haug's avatar Nathan Haug
Browse files

#141571. Adding formatter "URL, as link".

parent 473ca0e1
......@@ -392,6 +392,9 @@ function link_theme() {
'link_formatter_plain' => array(
'arguments' => array('element' => NULL),
),
'link_formatter_url' => array(
'arguments' => array('element' => NULL),
),
'link_formatter_short' => array(
'arguments' => array('element' => NULL),
),
......@@ -491,12 +494,17 @@ function link_process($element, $edit, $form_state, $form) {
function link_field_formatter_info() {
return array(
'default' => array(
'label' => t('Default, as link with title'),
'label' => t('Title, as link (default)'),
'field types' => array('link'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'url' => array(
'label' => t('URL, as link'),
'field types' => array('link'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'plain' => array(
'label' => t('Plain, as the text URL'),
'label' => t('URL, as plain text'),
'field types' => array('link'),
'multiple values' => CONTENT_HANDLE_CORE,
),
......@@ -534,6 +542,13 @@ function theme_link_formatter_plain($element) {
return empty($element['#item']['url']) ? check_plain($element['#item']['title']) : check_plain($element['#item']['url']);
}
/**
* Theme function for 'url' text field formatter.
*/
function theme_link_formatter_url($element) {
return $element['#item']['url'] ? l($element['#item']['display_url'], $element['#item']['url'], $element['#item']) : '';
}
/**
* Theme function for 'short' text field formatter.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment