MenuLinkContentForm::form

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

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;
}
doc_Drupal
2016-10-29 09:26:44
Comments
Leave a Comment

Please login to continue.