public function NodeLimitForm::form in Node Limit 8
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/ NodeLimitForm.php, line 17
Class
- NodeLimitForm
- Builds the NodeLimitForm form.
Namespace
Drupal\node_limit\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$node_limit = $this->entity;
$form['label'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $node_limit
->label(),
'#description' => $this
->t("Label for the NodeLimit."),
'#required' => TRUE,
);
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => $node_limit
->id(),
'#machine_name' => array(
'exists' => '\\Drupal\\node_limit\\Entity\\NodeLimit::load',
),
'#disabled' => !$node_limit
->isNew(),
);
// You will need additional form elements for your custom properties.
return $form;
}