You are here

public function ViewDuplicateForm::form in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/ViewDuplicateForm.php \Drupal\views_ui\ViewDuplicateForm::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

core/modules/views_ui/src/ViewDuplicateForm.php, line 27
Contains \Drupal\views_ui\ViewDuplicateForm.

Class

ViewDuplicateForm
Form controller for the Views duplicate form.

Namespace

Drupal\views_ui

Code

public function form(array $form, FormStateInterface $form_state) {
  parent::form($form, $form_state);
  $form['#title'] = $this
    ->t('Duplicate of @label', array(
    '@label' => $this->entity
      ->label(),
  ));
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('View name'),
    '#required' => TRUE,
    '#size' => 32,
    '#maxlength' => 255,
    '#default_value' => $this
      ->t('Duplicate of @label', array(
      '@label' => $this->entity
        ->label(),
    )),
  );
  $form['id'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 128,
    '#machine_name' => array(
      'exists' => '\\Drupal\\views\\Views::getView',
      'source' => array(
        '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;
}