/** * {@inheritdoc} */ public function form(array $form, FormStateInterface $form_state) { $form['#title'] = $this->entity->label(); if (!isset($this->entity->book)) { // The node is not part of any book yet - set default options. $this->entity->book = $this->bookManager->getLinkDefaults($this->entity->id()); } else { $this->entity->book['original_bid'] = $this->entity->book['bid']; } // Find the depth limit for the parent select. if (!isset($this->entity->book['parent_depth_limit'])) { $this->entity->book['parent_depth_limit'] = $this->bookManager->getParentDepthLimit($this->entity->book); } $form = $this->bookManager->addFormElements($form, $form_state, $this->entity, $this->currentUser(), FALSE); return $form; }