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
bf801458
Commit
bf801458
authored
May 05, 2007
by
Nathan Haug
Browse files
Prevents "prepare" operation on link data twice when editing the node form. #141594.
parent
9bbec529
Changes
1
Hide whitespace changes
Inline
Side-by-side
link.module
View file @
bf801458
...
@@ -232,19 +232,16 @@ function link_widget_info() {
...
@@ -232,19 +232,16 @@ function link_widget_info() {
function
link_widget
(
$op
,
&
$node
,
$field
,
&
$node_field
)
{
function
link_widget
(
$op
,
&
$node
,
$field
,
&
$node_field
)
{
switch
(
$op
)
{
switch
(
$op
)
{
case
'prepare form values'
:
case
'prepare form values'
:
if
(
$_POST
[
$field
[
'field_name'
]])
{
$node_field
=
$_POST
[
$field
[
'field_name'
]];
unset
(
$node_field
[
'count'
]);
unset
(
$node_field
[
'more-url'
]);
unset
(
$node_field
[
'more'
]);
}
case
'form'
:
foreach
(
$node_field
as
$delta
=>
$value
)
{
foreach
(
$node_field
as
$delta
=>
$value
)
{
if
(
is_numeric
(
$delta
))
{
if
(
is_numeric
(
$delta
))
{
_link_widget_prepare
(
$node_field
[
$delta
],
$delta
);
_link_widget_prepare
(
$node_field
[
$delta
],
$delta
);
}
}
}
}
if
(
$_POST
[
$field
[
'field_name'
]])
{
$node_field
=
$_POST
[
$field
[
'field_name'
]];
unset
(
$node_field
[
'count'
],
$node_field
[
'more-url'
],
$node_field
[
'more'
]);
}
case
'form'
:
$form
=
array
();
$form
=
array
();
$form
[
$field
[
'field_name'
]]
=
array
(
$form
[
$field
[
'field_name'
]]
=
array
(
'#tree'
=>
TRUE
,
'#tree'
=>
TRUE
,
...
@@ -272,7 +269,7 @@ function link_widget($op, &$node, $field, &$node_field) {
...
@@ -272,7 +269,7 @@ function link_widget($op, &$node, $field, &$node_field) {
}
}
// Render two additional new link fields
// Render two additional new link fields
foreach
(
range
(
$delta
,
$delta
+
1
)
as
$delta
)
{
foreach
(
range
(
$delta
,
$delta
+
1
)
as
$delta
)
{
_link_widget_form
(
$form
[
$field
[
'field_name'
]][
$delta
],
$field
,
$node_field
,
$delta
);
_link_widget_form
(
$form
[
$field
[
'field_name'
]][
$delta
],
$field
,
array
()
,
$delta
);
}
}
// Create a wrapper for additional fields
// Create a wrapper for additional fields
...
...
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