You are here

public function RemoveViewsCustomTable::buildForm in Views Custom Table 8

Same name and namespace in other branches
  1. 9.0.x src/Form/RemoveViewsCustomTable.php \Drupal\view_custom_table\Form\RemoveViewsCustomTable::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/RemoveViewsCustomTable.php, line 60

Class

RemoveViewsCustomTable
Add views custom table form.

Namespace

Drupal\view_custom_table\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $table_name = NULL) {
  $form['message'] = [
    '#type' => 'markup',
    '#markup' => $this
      ->t('Do you want to remove @table from views custom tables ?', [
      '@table' => $table_name,
    ]),
  ];
  $form['table_name'] = [
    '#type' => 'hidden',
    '#value' => $table_name,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Delete'),
  ];
  $form['actions']['cancel'] = [
    '#type' => 'link',
    '#title' => $this
      ->t('Cancel'),
    '#url' => $this
      ->buildCancelLinkUrl(),
  ];
  return $form;
}