Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
link
Commits
93b7f6b4
Commit
93b7f6b4
authored
Dec 04, 2010
by
John C Fiala
Browse files
bug report #956182 by jmiccolis, bec, Bevan: Theme fixing for the theme_link_field
parent
50761cbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
link.info
View file @
93b7f6b4
...
...
@@ -4,3 +4,10 @@ description = Defines simple link field types.
core = 7.x
files[] = link.module
files[] = link.install
; Information added by drupal.org packaging script on 2010-10-18
version = "7.x-1.x-dev"
core = "7.x"
project = "link"
datestamp = "1287403997"
link.module
View file @
93b7f6b4
...
...
@@ -585,7 +585,7 @@ function link_theme() {
'variables'
=>
array
(
'element'
=>
NULL
),
),
'link_field'
=>
array
(
'
variables'
=>
array
(
'element'
=>
NULL
)
,
'
render element'
=>
'element'
,
),
);
}
...
...
@@ -593,29 +593,26 @@ function link_theme() {
/**
* FAPI theme for an individual text elements.
*/
function
theme_link_field
(
$
element
)
{
function
theme_link_field
(
$
vars
)
{
drupal_add_css
(
drupal_get_path
(
'module'
,
'link'
)
.
'/link.css'
);
$element
=
$vars
[
'element'
];
// Prefix single value link fields with the name of the field.
if
(
empty
(
$element
[
'#field'
][
'multiple'
]))
{
if
(
isset
(
$element
[
'url'
])
&&
isset
(
$element
[
'title'
]))
{
$element
[
'url'
][
'#title'
]
=
$element
[
'#title'
]
.
' '
.
$element
[
'url'
][
'#title'
];
$element
[
'title'
][
'#title'
]
=
$element
[
'#title'
]
.
' '
.
$element
[
'title'
][
'#title'
];
}
elseif
(
$element
[
'url'
])
{
$element
[
'url'
][
'#title'
]
=
$element
[
'#title'
];
if
(
isset
(
$element
[
'url'
])
&&
!
isset
(
$element
[
'title'
]))
{
unset
(
$element
[
'url'
][
'#title'
]);
}
}
$output
=
''
;
$output
.
=
'<div class="link-field-subrow clear
-block
">'
;
$output
.
=
'<div class="link-field-subrow clear
fix
">'
;
if
(
isset
(
$element
[
'title'
]))
{
$output
.
=
'<div class="link-field-title link-field-column">'
.
theme
(
'textfield'
,
$element
[
'title'
])
.
'</div>'
;
$output
.
=
'<div class="link-field-title link-field-column">'
.
drupal_render
(
$element
[
'title'
])
.
'</div>'
;
}
$output
.
=
'<div class="link-field-url'
.
(
isset
(
$element
[
'title'
])
?
' link-field-column'
:
''
)
.
'">'
.
theme
(
'textfield'
,
$element
[
'url'
])
.
'</div>'
;
$output
.
=
'<div class="link-field-url'
.
(
isset
(
$element
[
'title'
])
?
' link-field-column'
:
''
)
.
'">'
.
drupal_render
(
$element
[
'url'
])
.
'</div>'
;
$output
.
=
'</div>'
;
if
(
!
empty
(
$element
[
'attributes'
][
'target'
]))
{
$output
.
=
'<div class="link-attributes">'
.
theme
(
'checkbox'
,
$element
[
'attributes'
][
'target'
])
.
'</div>'
;
$output
.
=
'<div class="link-attributes">'
.
drupal_render
(
$element
[
'attributes'
][
'target'
])
.
'</div>'
;
}
return
$output
;
}
...
...
@@ -628,6 +625,8 @@ function link_element_info() {
$elements
[
'link_field'
]
=
array
(
'#input'
=>
TRUE
,
'#process'
=>
array
(
'link_field_process'
),
'#theme'
=>
'link_field'
,
'#theme_wrappers'
=>
array
(
'form_element'
),
);
return
$elements
;
}
...
...
@@ -654,7 +653,6 @@ function link_field_process($element, $form_state, $form) {
'#type'
=>
'textfield'
,
'#maxlength'
=>
LINK_URL_MAX_LENGTH
,
'#title'
=>
t
(
'URL'
),
'#description'
=>
$element
[
'#description'
],
'#required'
=>
(
$element
[
'#delta'
]
==
0
&&
$settings
[
'url'
]
!==
'optional'
)
?
$element
[
'#required'
]
:
FALSE
,
'#default_value'
=>
isset
(
$element
[
'#value'
][
'url'
])
?
$element
[
'#value'
][
'url'
]
:
NULL
,
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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