Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
link
Commits
b31f1850
Commit
b31f1850
authored
Feb 19, 2019
by
Neil Drumm
Browse files
Ensure attributes are not strings
parent
90a59d39
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
link.module
link.module
+10
-0
No files found.
link.module
View file @
b31f1850
...
...
@@ -315,6 +315,16 @@ function link_field_validate($entity_type, $entity, $field, $instance, $langcode
}
}
foreach
(
$items
as
$delta
=>
$value
)
{
if
(
isset
(
$value
[
'attributes'
])
&&
is_string
(
$value
[
'attributes'
]))
{
$errors
[
$field
[
'field_name'
]][
$langcode
][
$delta
][]
=
array
(
'error'
=>
'link_required'
,
'message'
=>
t
(
'String values are not acceptable for attributes.'
),
'error_element'
=>
array
(
'url'
=>
TRUE
,
'title'
=>
FALSE
),
);
}
}
if
(
$instance
[
'settings'
][
'url'
]
===
'optional'
&&
$instance
[
'settings'
][
'title'
]
===
'optional'
&&
$instance
[
'required'
]
&&
!
$optional_field_found
)
{
$errors
[
$field
[
'field_name'
]][
$langcode
][
0
][]
=
array
(
'error'
=>
'link_required'
,
...
...
Write
Preview
Markdown
is supported
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