public function RemoteForm::form in Entity Share 8.3
Same name and namespace in other branches
- 8 modules/entity_share_client/src/Form/RemoteForm.php \Drupal\entity_share_client\Form\RemoteForm::form()
- 8.2 modules/entity_share_client/src/Form/RemoteForm.php \Drupal\entity_share_client\Form\RemoteForm::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
- modules/
entity_share_client/ src/ Form/ RemoteForm.php, line 48
Class
- RemoteForm
- Entity form of the remote entity.
Namespace
Drupal\entity_share_client\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\entity_share_client\Entity\RemoteInterface $remote */
$remote = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $remote
->label(),
'#description' => $this
->t('Label for the remote website.'),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $remote
->id(),
'#machine_name' => [
'source' => [
'label',
],
'exists' => '\\Drupal\\entity_share_client\\Entity\\Remote::load',
],
'#disabled' => !$remote
->isNew(),
];
$form['url'] = [
'#type' => 'url',
'#title' => $this
->t('URL'),
'#maxlength' => 255,
'#description' => $this
->t('The remote URL. Example: http://example.com'),
'#default_value' => $remote
->get('url'),
'#required' => TRUE,
];
$this
->addAuthOptions($form, $form_state);
return $form;
}