public MenuLinkContentForm::form(array $form, FormStateInterface $form_state)
Gets the actual form array to be built.
Overrides ContentEntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- core/modules/menu_link_content/src/Form/MenuLinkContentForm.php, line 72
Class
- MenuLinkContentForm
- Provides a form to add/update content menu links.
Namespace
Drupal\menu_link_content\Form
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 | public function form( array $form , FormStateInterface $form_state ) { $form = parent::form( $form , $form_state ); $default = $this ->entity->getMenuName() . ':' . $this ->entity->getParentId(); $id = $this ->entity->isNew() ? '' : $this ->entity->getPluginId(); $form [ 'menu_parent' ] = $this ->menuParentSelector->parentSelectElement( $default , $id ); $form [ 'menu_parent' ][ '#weight' ] = 10; $form [ 'menu_parent' ][ '#title' ] = $this ->t( 'Parent link' ); $form [ 'menu_parent' ][ '#description' ] = $this ->t( 'The maximum depth for a link and all its children is fixed. Some menu links may not be available as parents if selecting them would exceed this limit.' ); $form [ 'menu_parent' ][ '#attributes' ][ 'class' ][] = 'menu-title-select' ; return $form ; } |
Please login to continue.