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
6587e544
Commit
6587e544
authored
Feb 07, 2011
by
John C Fiala
Browse files
bug report by jcfiala: Fixed error from missing index by changing ['required'] to ['required']
parent
9c7092e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
link.module
View file @
6587e544
...
...
@@ -287,7 +287,10 @@ function _link_process(&$item, $delta = 0, $field, $entity) {
* Validates that the link field has been entered properly.
*/
function
_link_validate
(
&
$item
,
$delta
,
$field
,
$node
,
$instance
,
&
$optional_field_found
)
{
if
(
$item
[
'url'
]
&&
!
(
isset
(
$instance
[
'default_value'
][
$delta
][
'url'
])
&&
$item
[
'url'
]
===
$instance
[
'default_value'
][
$delta
][
'url'
]
&&
!
$item
[
'required'
]))
{
if
(
$item
[
'url'
]
&&
!
(
isset
(
$instance
[
'default_value'
][
$delta
][
'url'
])
&&
$item
[
'url'
]
===
$instance
[
'default_value'
][
$delta
][
'url'
]
&&
!
$instance
[
'required'
]))
{
// Validate the link.
if
(
link_validate_url
(
trim
(
$item
[
'url'
]))
==
FALSE
)
{
form_set_error
(
$field
[
'field_name'
]
.
']['
.
$delta
.
'][url'
,
t
(
'Not a valid URL.'
));
...
...
@@ -340,6 +343,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$node) {
// Replace URL tokens.
if
(
$instance
[
'settings'
][
'enable_tokens'
])
{
global
$user
;
// Load the node if necessary for nodes in views.
$token_node
=
isset
(
$node
->
nid
)
?
node_load
(
$node
->
nid
)
:
$node
;
$item
[
'url'
]
=
token_replace
(
$item
[
'url'
],
array
(
'node'
=>
$token_node
));
...
...
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