public function ServiceEndpointForm::form in Services 8.4
Same name and namespace in other branches
- 9.0.x src/Form/ServiceEndpointForm.php \Drupal\services\Form\ServiceEndpointForm::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/ ServiceEndpointForm.php, line 44
Class
Namespace
Drupal\services\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\services\Entity\ServiceEndpoint $service_endpoint */
$service_endpoint = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $service_endpoint
->label(),
'#description' => $this
->t('Label for the service endpoint.'),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $service_endpoint
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\services\\Entity\\ServiceEndpoint::load',
],
'#disabled' => !$service_endpoint
->isNew(),
];
$form['endpoint'] = [
'#type' => 'textfield',
'#title' => $this
->t('Endpoint'),
'#maxlength' => 255,
'#default_value' => $service_endpoint
->getEndpoint(),
'#description' => $this
->t('URL endpoint.'),
'#required' => TRUE,
];
return $form;
}