public function ViewCloneFormController::form

Overrides \Drupal\Core\Entity\EntityFormController::form().

Overrides EntityFormController::form

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/ViewCloneFormController.php, line 34
Contains \Drupal\views_ui\ViewCloneFormController.

Class

ViewCloneFormController
Form controller for the Views clone form.

Namespace

Drupal\views_ui

Code

public function form(array $form, array &$form_state) {
  parent::form($form, $form_state);
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('View name'),
    '#required' => TRUE,
    '#size' => 32,
    '#default_value' => '',
    '#maxlength' => 255,
    '#default_value' => t('Clone of @label', array(
      '@label' => $this->entity
        ->label(),
    )),
  );
  $form['id'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 128,
    '#machine_name' => array(
      'exists' => 'views_get_view',
      'source' => array(
        'label',
      ),
    ),
    '#default_value' => '',
    '#description' => t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
  );
  return $form;
}