public function LinkTypeForm::form in Colossal Menu 8
Same name and namespace in other branches
- 2.x src/Form/LinkTypeForm.php \Drupal\colossal_menu\Form\LinkTypeForm::form()
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
Form/ LinkTypeForm.php, line 18
Class
- LinkTypeForm
- Settings form for Link types.
Namespace
Drupal\colossal_menu\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$colossal_menu_link_type = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $colossal_menu_link_type
->label(),
'#description' => $this
->t("Label for the Link type."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $colossal_menu_link_type
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\colossal_menu\\Entity\\LinkType::load',
],
'#disabled' => !$colossal_menu_link_type
->isNew(),
];
/* You will need additional form elements for your custom properties. */
return $form;
}