public function MollieProfileForm::form in Mollie Payment 8.2
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/
Entity/ MollieProfile/ MollieProfileForm.php, line 72
Class
- MollieProfileForm
- Provides the Mollie profile add/edit form.
Namespace
Drupal\mollie_payment\Entity\MollieProfileCode
public function form(array $form, FormStateInterface $form_state) {
/** @var \Drupal\mollie_payment\Entity\MollieProfilesInterface $mollie_profile */
$mollie_profile = $this
->getEntity();
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#default_value' => $mollie_profile
->label(),
'#maxlength' => 255,
'#required' => TRUE,
];
$form['id'] = [
'#default_value' => $mollie_profile
->id(),
'#disabled' => !$mollie_profile
->isNew(),
'#machine_name' => [
'source' => [
'label',
],
'exists' => [
$this,
'MollieProfileIdExists',
],
],
'#maxlength' => 255,
'#type' => 'machine_name',
'#required' => TRUE,
];
$form['apiKey'] = [
'#type' => 'textfield',
'#title' => $this
->t('API key'),
'#default_value' => $mollie_profile
->getApiKey(),
'#maxlength' => 255,
'#required' => TRUE,
];
return parent::form($form, $form_state);
}