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
c3ecc1f9
Commit
c3ecc1f9
authored
Nov 20, 2011
by
catch
Browse files
Rollback of
#589440
which needs more discussion.
parent
19b1c783
Changes
2
Show whitespace changes
Inline
Side-by-side
core/modules/book/book.admin.inc
View file @
c3ecc1f9
...
...
@@ -174,6 +174,10 @@ function _book_admin_table($node, &$form) {
* @see book_admin_edit()
*/
function
_book_admin_table_tree
(
$tree
,
&
$form
)
{
// The delta must be big enough to give each node a distinct value.
$count
=
count
(
$tree
);
$delta
=
(
$count
<
30
)
?
15
:
intval
(
$count
/
2
)
+
1
;
foreach
(
$tree
as
$data
)
{
$form
[
'book-admin-'
.
$data
[
'link'
][
'nid'
]]
=
array
(
'#item'
=>
$data
[
'link'
],
...
...
@@ -187,12 +191,9 @@ function _book_admin_table_tree($tree, &$form) {
'#size'
=>
40
,
),
'weight'
=>
array
(
// Using a textfield and a validator instead of a simple weight select
// to avoid unnecessarily oversized HTML for books with hundreds of
// pages.
'#type'
=>
'textfield'
,
'#element_validate'
=>
array
(
'element_validate_integer'
),
'#type'
=>
'weight'
,
'#default_value'
=>
$data
[
'link'
][
'weight'
],
'#delta'
=>
max
(
$delta
,
abs
(
$data
[
'link'
][
'weight'
])),
'#title'
=>
t
(
'Weight for @title'
,
array
(
'@title'
=>
$data
[
'link'
][
'title'
])),
'#title_display'
=>
'invisible'
,
),
...
...
core/modules/book/book.module
View file @
c3ecc1f9
...
...
@@ -515,12 +515,10 @@ function _book_add_form_elements(&$form, &$form_state, $node) {
// @see _book_admin_table_tree(). The weight may be larger than 15.
$form
[
'book'
][
'weight'
]
=
array
(
// Using a textfield and a validator instead of a simple weight select to
// avoid unnecessarily oversized HTML for books with hundreds of pages.
'#type'
=>
'textfield'
,
'#element_validate'
=>
array
(
'element_validate_integer'
),
'#type'
=>
'weight'
,
'#title'
=>
t
(
'Weight'
),
'#default_value'
=>
$node
->
book
[
'weight'
],
'#delta'
=>
max
(
15
,
abs
(
$node
->
book
[
'weight'
])),
'#weight'
=>
5
,
'#description'
=>
t
(
'Pages at a given level are ordered first by weight and then by title.'
),
);
...
...
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