Returns the actual form array to be built.
Overrides EntityFormController::form
Drupal\Core\Entity\EntityFormController::build()
public function form(array $form, array &$form_state) {
$entity = $this->entity;
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Role name'),
'#default_value' => $entity
->label(),
'#size' => 30,
'#required' => TRUE,
'#maxlength' => 64,
'#description' => t('The name for this role. Example: "Moderator", "Editorial board", "Site architect".'),
);
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => $entity
->id(),
'#required' => TRUE,
'#disabled' => !$entity
->isNew(),
'#size' => 30,
'#maxlength' => 64,
'#machine_name' => array(
'exists' => 'user_role_load',
),
);
$form['weight'] = array(
'#type' => 'value',
'#value' => $entity
->get('weight'),
);
return parent::form($form, $form_state, $entity);
}