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
75597feb
Commit
75597feb
authored
Jun 06, 2008
by
Nathan Haug
Browse files
#266218 by sun. Add formatter for separate title and URL.
parent
0a6d5808
Changes
1
Hide whitespace changes
Inline
Side-by-side
link.module
View file @
75597feb
...
...
@@ -401,6 +401,9 @@ function link_theme() {
'link_formatter_label'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'link_formatter_separate'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
'link'
=>
array
(
'arguments'
=>
array
(
'element'
=>
NULL
),
),
...
...
@@ -518,6 +521,11 @@ function link_field_formatter_info() {
'field types'
=>
array
(
'link'
),
'multiple values'
=>
CONTENT_HANDLE_CORE
,
),
'separate'
=>
array
(
'label'
=>
t
(
'Separate title and URL'
),
'field types'
=>
array
(
'link'
),
'multiple values'
=>
CONTENT_HANDLE_CORE
,
),
);
}
...
...
@@ -557,12 +565,24 @@ function theme_link_formatter_short($element) {
}
/**
* Theme function for '
short
' text field formatter.
* Theme function for '
label
' text field formatter.
*/
function
theme_link_formatter_label
(
$element
)
{
return
$element
[
'#item'
][
'url'
]
?
l
(
$element
[
'#item'
][
'label'
],
$element
[
'#item'
][
'url'
],
$element
[
'#item'
])
:
''
;
}
/**
* Theme function for 'separate' text field formatter.
*/
function
theme_link_formatter_separate
(
$element
)
{
$output
=
''
;
$output
.
=
'<div class="link-item">'
;
$output
.
=
'<div class="link-title">'
.
$element
[
'#item'
][
'display_title'
]
.
'</div>'
;
$output
.
=
'<div class="link-url">'
.
l
(
$element
[
'#item'
][
'display_url'
],
$element
[
'#item'
][
'url'
],
$element
[
'#item'
])
.
'</div>'
;
$output
.
=
'</div>'
;
return
$output
;
}
function
link_token_list
(
$type
=
'all'
)
{
if
(
$type
==
'field'
||
$type
==
'all'
)
{
$tokens
=
array
();
...
...
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