function _book_admin_table_tree

Helps build the main table in the book administration page form.

Parameters

$tree: A subtree of the book menu hierarchy.

$form: The form that is being modified, passed by reference.

Return value

The modified form array.

See also

book_admin_edit()

1 call to _book_admin_table_tree()
_book_admin_table in modules/book/book.admin.inc
Builds the table portion of the form for the book administration page.

File

modules/book/book.admin.inc, line 201

Code

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'],
            'nid' => array(
                '#type' => 'value',
                '#value' => $data['link']['nid'],
            ),
            'depth' => array(
                '#type' => 'value',
                '#value' => $data['link']['depth'],
            ),
            'href' => array(
                '#type' => 'value',
                '#value' => $data['link']['href'],
            ),
            'title' => array(
                '#type' => 'textfield',
                '#default_value' => $data['link']['link_title'],
                '#maxlength' => 255,
                '#size' => 40,
            ),
            'weight' => array(
                '#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',
            ),
            'plid' => array(
                '#type' => 'hidden',
                '#default_value' => $data['link']['plid'],
            ),
            'mlid' => array(
                '#type' => 'hidden',
                '#default_value' => $data['link']['mlid'],
            ),
        );
        if ($data['below']) {
            _book_admin_table_tree($data['below'], $form);
        }
    }
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.