protected BookAdminEditForm::bookAdminTable(NodeInterface $node, array &$form)
Builds the table portion of the form for the book administration page.
Parameters
\Drupal\node\NodeInterface $node: The node of the top-level page in the book.
array $form: The form that is being modified, passed by reference.
See also
self::buildForm()
File
- core/modules/book/src/Form/BookAdminEditForm.php, line 141
Class
- BookAdminEditForm
- Provides a form for administering a single book's hierarchy.
Namespace
Drupal\book\Form
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | protected function bookAdminTable(NodeInterface $node , array & $form ) { $form [ 'table' ] = array ( '#type' => 'table' , '#header' => [ $this ->t( 'Title' ), $this ->t( 'Weight' ), $this ->t( 'Parent' ), $this ->t( 'Operations' ), ], '#empty' => $this ->t( 'No book content available.' ), '#tabledrag' => [ [ 'action' => 'match' , 'relationship' => 'parent' , 'group' => 'book-pid' , 'subgroup' => 'book-pid' , 'source' => 'book-nid' , 'hidden' => TRUE, 'limit' => BookManager::BOOK_MAX_DEPTH - 2, ], [ 'action' => 'order' , 'relationship' => 'sibling' , 'group' => 'book-weight' , ], ], ); $tree = $this ->bookManager->bookSubtreeData( $node ->book); // Do not include the book item itself. $tree = array_shift ( $tree ); if ( $tree [ 'below' ]) { $hash = Crypt::hashBase64(serialize( $tree [ 'below' ])); // Store the hash value as a hidden form element so that we can detect // if another user changed the book hierarchy. $form [ 'tree_hash' ] = array ( '#type' => 'hidden' , '#default_value' => $hash , ); $form [ 'tree_current_hash' ] = array ( '#type' => 'value' , '#value' => $hash , ); $this ->bookAdminTableTree( $tree [ 'below' ], $form [ 'table' ]); } } |
Please login to continue.