Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
b9415b4b
Commit
b9415b4b
authored
Nov 29, 2005
by
Steven Wittens
Browse files
-
#7940
: Remember publishing options when editing node
parent
670e8357
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/node.module
View file @
b9415b4b
...
...
@@ -1609,26 +1609,46 @@ function node_form($node) {
// Get the node-specific bits.
$form
=
array_merge
(
$form
,
node_invoke
(
$node
,
'form'
));
/**
* Node author information
*/
// If this is a new node, fill in the default values.
$node_options
=
variable_get
(
'node_options_'
.
$node
->
type
,
array
(
'status'
,
'promote'
));
if
(
!
isset
(
$node
->
status
))
{
$node
->
status
=
in_array
(
'status'
,
$node_options
);
}
if
(
!
isset
(
$node
->
moderate
))
{
$node
->
moderate
=
in_array
(
'moderate'
,
$node_options
);
}
if
(
!
isset
(
$node
->
promote
))
{
$node
->
promote
=
in_array
(
'promote'
,
$node_options
);
}
if
(
!
isset
(
$node
->
sticky
))
{
$node
->
sticky
=
in_array
(
'sticky'
,
$node_options
);
}
if
(
!
isset
(
$node
->
revision
))
{
$node
->
revision
=
in_array
(
'revision'
,
$node_options
);
}
if
(
user_access
(
'administer nodes'
))
{
// Node author information
$form
[
'author'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Authoring information'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
'#weight'
=>
-
5
);
$form
[
'author'
][
'name'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Authored by'
),
'#maxlength'
=>
60
,
'#autocomplete_path'
=>
'user/autocomplete'
,
'#required'
=>
TRUE
,
'#default_value'
=>
$node
->
name
,
'#weight'
=>
-
1
);
$form
[
'author'
][
'date'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Authored on'
),
'#maxlength'
=>
25
,
'#required'
=>
TRUE
,
'#default_value'
=>
$node
->
date
);
$node_options
=
variable_get
(
'node_options_'
.
$node
->
type
,
array
(
'status'
,
'promote'
));
/**
* Node options
*/
// Node options for administrators
$form
[
'options'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Publishing options'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
'#weight'
=>
-
5
);
$form
[
'options'
][
'status'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Published'
),
'#default_value'
=>
in_array
(
'status'
,
$node_options
));
$form
[
'options'
][
'moderate'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'In moderation queue'
),
'#default_value'
=>
in_array
(
'moderate'
,
$node_options
));
$form
[
'options'
][
'promote'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Promoted to front page'
),
'#default_value'
=>
in_array
(
'promote'
,
$node_options
));
$form
[
'options'
][
'sticky'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Sticky at top of lists'
),
'#default_value'
=>
in_array
(
'sticky'
,
$node_options
));
$form
[
'options'
][
'revision'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Create new revision'
),
'#default_value'
=>
in_array
(
'revision'
,
$node_options
));
$form
[
'options'
][
'status'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Published'
),
'#default_value'
=>
$node
->
status
);
$form
[
'options'
][
'moderate'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'In moderation queue'
),
'#default_value'
=>
$node
->
moderate
);
$form
[
'options'
][
'promote'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Promoted to front page'
),
'#default_value'
=>
$node
->
promote
);
$form
[
'options'
][
'sticky'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Sticky at top of lists'
),
'#default_value'
=>
$node
->
sticky
);
$form
[
'options'
][
'revision'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Create new revision'
),
'#default_value'
=>
$node
->
revision
);
}
else
{
// Don't show node options because the user doesn't have admin access.
$form
[
'status'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
status
);
$form
[
'moderate'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
moderate
);
$form
[
'promote'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
promote
);
$form
[
'sticky'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
sticky
);
$form
[
'revision'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
revision
);
}
$nodeapi
=
node_invoke_nodeapi
(
$node
,
'form'
);
...
...
modules/node/node.module
View file @
b9415b4b
...
...
@@ -1609,26 +1609,46 @@ function node_form($node) {
// Get the node-specific bits.
$form
=
array_merge
(
$form
,
node_invoke
(
$node
,
'form'
));
/**
* Node author information
*/
// If this is a new node, fill in the default values.
$node_options
=
variable_get
(
'node_options_'
.
$node
->
type
,
array
(
'status'
,
'promote'
));
if
(
!
isset
(
$node
->
status
))
{
$node
->
status
=
in_array
(
'status'
,
$node_options
);
}
if
(
!
isset
(
$node
->
moderate
))
{
$node
->
moderate
=
in_array
(
'moderate'
,
$node_options
);
}
if
(
!
isset
(
$node
->
promote
))
{
$node
->
promote
=
in_array
(
'promote'
,
$node_options
);
}
if
(
!
isset
(
$node
->
sticky
))
{
$node
->
sticky
=
in_array
(
'sticky'
,
$node_options
);
}
if
(
!
isset
(
$node
->
revision
))
{
$node
->
revision
=
in_array
(
'revision'
,
$node_options
);
}
if
(
user_access
(
'administer nodes'
))
{
// Node author information
$form
[
'author'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Authoring information'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
'#weight'
=>
-
5
);
$form
[
'author'
][
'name'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Authored by'
),
'#maxlength'
=>
60
,
'#autocomplete_path'
=>
'user/autocomplete'
,
'#required'
=>
TRUE
,
'#default_value'
=>
$node
->
name
,
'#weight'
=>
-
1
);
$form
[
'author'
][
'date'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Authored on'
),
'#maxlength'
=>
25
,
'#required'
=>
TRUE
,
'#default_value'
=>
$node
->
date
);
$node_options
=
variable_get
(
'node_options_'
.
$node
->
type
,
array
(
'status'
,
'promote'
));
/**
* Node options
*/
// Node options for administrators
$form
[
'options'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Publishing options'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
'#weight'
=>
-
5
);
$form
[
'options'
][
'status'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Published'
),
'#default_value'
=>
in_array
(
'status'
,
$node_options
));
$form
[
'options'
][
'moderate'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'In moderation queue'
),
'#default_value'
=>
in_array
(
'moderate'
,
$node_options
));
$form
[
'options'
][
'promote'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Promoted to front page'
),
'#default_value'
=>
in_array
(
'promote'
,
$node_options
));
$form
[
'options'
][
'sticky'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Sticky at top of lists'
),
'#default_value'
=>
in_array
(
'sticky'
,
$node_options
));
$form
[
'options'
][
'revision'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Create new revision'
),
'#default_value'
=>
in_array
(
'revision'
,
$node_options
));
$form
[
'options'
][
'status'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Published'
),
'#default_value'
=>
$node
->
status
);
$form
[
'options'
][
'moderate'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'In moderation queue'
),
'#default_value'
=>
$node
->
moderate
);
$form
[
'options'
][
'promote'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Promoted to front page'
),
'#default_value'
=>
$node
->
promote
);
$form
[
'options'
][
'sticky'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Sticky at top of lists'
),
'#default_value'
=>
$node
->
sticky
);
$form
[
'options'
][
'revision'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Create new revision'
),
'#default_value'
=>
$node
->
revision
);
}
else
{
// Don't show node options because the user doesn't have admin access.
$form
[
'status'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
status
);
$form
[
'moderate'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
moderate
);
$form
[
'promote'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
promote
);
$form
[
'sticky'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
sticky
);
$form
[
'revision'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$node
->
revision
);
}
$nodeapi
=
node_invoke_nodeapi
(
$node
,
'form'
);
...
...
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