Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
36764b59
Commit
36764b59
authored
Feb 27, 2010
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#716258
by mikeryan: Move node_object_prepare() to node.module.
parent
69384afc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
33 deletions
+33
-33
modules/node/node.module
modules/node/node.module
+33
-0
modules/node/node.pages.inc
modules/node/node.pages.inc
+0
-33
No files found.
modules/node/node.module
View file @
36764b59
...
...
@@ -886,6 +886,39 @@ function node_load($nid = NULL, $vid = NULL, $reset = FALSE) {
return
$node
?
reset
(
$node
)
:
FALSE
;
}
/**
* Prepares a node object for editing.
*
* Fills in a few default values, and then invokes hook_prepare() on the node
* type module, and hook_node_prepare() on all modules.
*/
function
node_object_prepare
(
$node
)
{
// Set up default values, if required.
$node_options
=
variable_get
(
'node_options_'
.
$node
->
type
,
array
(
'status'
,
'promote'
));
// If this is a new node, fill in the default values.
if
(
!
isset
(
$node
->
nid
)
||
isset
(
$node
->
is_new
))
{
foreach
(
array
(
'status'
,
'promote'
,
'sticky'
)
as
$key
)
{
// Multistep node forms might have filled in something already.
if
(
!
isset
(
$node
->
$key
))
{
$node
->
$key
=
(
int
)
in_array
(
$key
,
$node_options
);
}
}
global
$user
;
$node
->
uid
=
$user
->
uid
;
$node
->
created
=
REQUEST_TIME
;
}
else
{
$node
->
date
=
format_date
(
$node
->
created
,
'custom'
,
'Y-m-d H:i:s O'
);
// Remove the log message from the original node object.
$node
->
log
=
NULL
;
}
// Always use the default revision setting.
$node
->
revision
=
in_array
(
'revision'
,
$node_options
);
node_invoke
(
$node
,
'prepare'
);
module_invoke_all
(
'node_prepare'
,
$node
);
}
/**
* Perform validation checks on the given node.
*/
...
...
modules/node/node.pages.inc
View file @
36764b59
...
...
@@ -80,39 +80,6 @@ function node_form_validate($form, &$form_state) {
field_attach_form_validate
(
'node'
,
$node
,
$form
,
$form_state
);
}
/**
* Prepares a node object for editing.
*
* Fills in a few default values, and then invokes hook_prepare() on the node
* type module, and hook_node_prepare() on all modules.
*/
function
node_object_prepare
(
$node
)
{
// Set up default values, if required.
$node_options
=
variable_get
(
'node_options_'
.
$node
->
type
,
array
(
'status'
,
'promote'
));
// If this is a new node, fill in the default values.
if
(
!
isset
(
$node
->
nid
)
||
isset
(
$node
->
is_new
))
{
foreach
(
array
(
'status'
,
'promote'
,
'sticky'
)
as
$key
)
{
// Multistep node forms might have filled in something already.
if
(
!
isset
(
$node
->
$key
))
{
$node
->
$key
=
(
int
)
in_array
(
$key
,
$node_options
);
}
}
global
$user
;
$node
->
uid
=
$user
->
uid
;
$node
->
created
=
REQUEST_TIME
;
}
else
{
$node
->
date
=
format_date
(
$node
->
created
,
'custom'
,
'Y-m-d H:i:s O'
);
// Remove the log message from the original node object.
$node
->
log
=
NULL
;
}
// Always use the default revision setting.
$node
->
revision
=
in_array
(
'revision'
,
$node_options
);
node_invoke
(
$node
,
'prepare'
);
module_invoke_all
(
'node_prepare'
,
$node
);
}
/**
* Generate the node add/edit form array.
*/
...
...
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