function ViewDuplicateForm::form
Same name in other branches
- 9 core/modules/views_ui/src/ViewDuplicateForm.php \Drupal\views_ui\ViewDuplicateForm::form()
- 8.9.x core/modules/views_ui/src/ViewDuplicateForm.php \Drupal\views_ui\ViewDuplicateForm::form()
- 11.x core/modules/views_ui/src/ViewDuplicateForm.php \Drupal\views_ui\ViewDuplicateForm::form()
Overrides EntityForm::form
File
-
core/
modules/ views_ui/ src/ ViewDuplicateForm.php, line 57
Class
- ViewDuplicateForm
- Form controller for the Views duplicate form.
Namespace
Drupal\views_uiCode
public function form(array $form, FormStateInterface $form_state) {
parent::form($form, $form_state);
$form['#title'] = $this->t('Duplicate of @label', [
'@label' => $this->entity
->label(),
]);
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('View name'),
'#required' => TRUE,
'#size' => 32,
'#maxlength' => 255,
'#default_value' => $this->t('Duplicate of @label', [
'@label' => $this->entity
->label(),
]),
];
$form['id'] = [
'#type' => 'machine_name',
'#maxlength' => 128,
'#machine_name' => [
'exists' => '\\Drupal\\views\\Views::getView',
'source' => [
'label',
],
],
'#default_value' => '',
'#description' => $this->t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.