Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
link
Commits
0a6d5808
Commit
0a6d5808
authored
Jun 06, 2008
by
Nathan Haug
Browse files
#141571. Adding formatter "URL, as link".
parent
473ca0e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
link.module
View file @
0a6d5808
...
...
@@ -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.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment