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
517ef082
Commit
517ef082
authored
Jun 30, 2012
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1666074
by sun: Move 'default_nodes_main()' setting to node module.
parent
15f322b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
core/modules/node/node.module
core/modules/node/node.module
+31
-0
core/modules/system/system.admin.inc
core/modules/system/system.admin.inc
+0
-7
No files found.
core/modules/node/node.module
View file @
517ef082
...
...
@@ -2765,6 +2765,37 @@ function node_search_validate($form, &$form_state) {
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Alters System module's site information settings form to add a global default
* setting for number of posts to show on node listing pages.
*
* @see node_page_default()
* @see taxonomy_term_page()
* @see node_form_system_site_information_settings_form_submit()
*/
function
node_form_system_site_information_settings_form_alter
(
&
$form
,
&
$form_state
,
$form_id
)
{
$form
[
'front_page'
][
'default_nodes_main'
]
=
array
(
'#type'
=>
'select'
,
'#title'
=>
t
(
'Number of posts on front page'
),
'#default_value'
=>
variable_get
(
'default_nodes_main'
,
10
),
'#options'
=>
drupal_map_assoc
(
array
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
15
,
20
,
25
,
30
)),
'#access'
=>
(
variable_get
(
'site_frontpage'
)
==
'node'
),
'#description'
=>
t
(
'The maximum number of posts displayed on overview pages such as the front page.'
),
);
$form
[
'#submit'
][]
=
'node_form_system_site_information_settings_form_submit'
;
}
/**
* Form submission handler for system_site_information_settings().
*
* @see node_form_system_site_information_settings_form_alter()
*/
function
node_form_system_site_information_settings_form_submit
(
$form
,
&
$form_state
)
{
variable_set
(
'default_nodes_main'
,
$form_state
[
'values'
][
'default_nodes_main'
]);
}
/**
* Implements hook_form_FORM_ID_alter().
*
...
...
core/modules/system/system.admin.inc
View file @
517ef082
...
...
@@ -1501,13 +1501,6 @@ function system_site_information_settings() {
'#description'
=>
t
(
'Optionally, specify a relative URL to display as the front page. Leave blank to display the default content feed.'
),
'#field_prefix'
=>
url
(
NULL
,
array
(
'absolute'
=>
TRUE
)),
);
$form
[
'front_page'
][
'default_nodes_main'
]
=
array
(
'#type'
=>
'select'
,
'#title'
=>
t
(
'Number of posts on front page'
),
'#default_value'
=>
variable_get
(
'default_nodes_main'
,
10
),
'#options'
=>
drupal_map_assoc
(
array
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
15
,
20
,
25
,
30
)),
'#description'
=>
t
(
'The maximum number of posts displayed on overview pages such as the front page.'
),
'#access'
=>
(
variable_get
(
'site_frontpage'
)
==
'node'
),
);
$form
[
'error_page'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Error pages'
),
...
...
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