Overrides Drupal\Core\Entity\EntityFormController::form().
Overrides EntityFormController::form
public function form(array $form, array &$form_state, EntityInterface $category) {
$form = parent::form($form, $form_state, $category);
$default_category = config('contact.settings')
->get('default_category');
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#maxlength' => 255,
'#default_value' => $category
->label(),
'#description' => t("Example: 'website feedback' or 'product information'."),
'#required' => TRUE,
);
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => $category
->id(),
'#machine_name' => array(
'exists' => 'contact_category_load',
),
'#disabled' => !$category
->isNew(),
);
$form['recipients'] = array(
'#type' => 'textarea',
'#title' => t('Recipients'),
'#default_value' => implode(', ', $category->recipients),
'#description' => t("Example: 'webmaster@example.com' or 'sales@example.com,support@example.com' . To specify multiple recipients, separate each e-mail address with a comma."),
'#required' => TRUE,
);
$form['reply'] = array(
'#type' => 'textarea',
'#title' => t('Auto-reply'),
'#default_value' => $category->reply,
'#description' => t('Optional auto-reply. Leave empty if you do not want to send the user an auto-reply message.'),
);
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $category->weight,
'#description' => t('When listing categories, those with lighter (smaller) weights get listed before categories with heavier (larger) weights. Categories with equal weights are sorted alphabetically.'),
);
$form['selected'] = array(
'#type' => 'checkbox',
'#title' => t('Make this the default category.'),
'#default_value' => $default_category === $category
->id(),
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}