public function WrapperEntityForm::form in Backup and Migrate 5.0.x
Same name and namespace in other branches
- 8.4 src/Form/WrapperEntityForm.php \Drupal\backup_migrate\Form\WrapperEntityForm::form()
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
2 calls to WrapperEntityForm::form()
- DestinationForm::form in src/
Form/ DestinationForm.php - Gets the actual form array to be built.
- SourceForm::form in src/
Form/ SourceForm.php - Gets the actual form array to be built.
2 methods override WrapperEntityForm::form()
- DestinationForm::form in src/
Form/ DestinationForm.php - Gets the actual form array to be built.
- SourceForm::form in src/
Form/ SourceForm.php - Gets the actual form array to be built.
File
- src/
Form/ WrapperEntityForm.php, line 20
Class
- WrapperEntityForm
- @package Drupal\backup_migrate\Form
Namespace
Drupal\backup_migrate\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $this->entity
->label(),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $this->entity
->id(),
'#machine_name' => [],
'#disabled' => !$this->entity
->isNew(),
];
if (!$this->entity
->get('type')) {
$form['type'] = [
'#type' => 'radios',
'#title' => $this
->t('Type'),
];
foreach ($this->entity
->getPluginManager()
->getDefinitions() as $type) {
if (empty($type['locked'])) {
$form['type']['#options'][$type['id']] = $type['title'];
$form['type'][$type['id']]['#description'] = $type['description'];
}
}
}
else {
$type = $this->entity
->getPlugin()
->getPluginDefinition();
$form['type'] = [
'#type' => 'value',
'#value' => $type['id'],
'#markup' => $this
->t("Type: @type", [
'@type' => $type['title'],
]),
];
if ($bam_plugin = $this->entity
->getObject()) {
$form['config'] = DrupalConfigHelper::buildPluginForm($bam_plugin, 'initialize', [
'config',
]);
}
}
return $form;
}