You are here

public function RemoveViewsCustomTable::submitForm in Views Custom Table 9.0.x

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

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/Form/RemoveViewsCustomTable.php, line 113

Class

RemoveViewsCustomTable
Add views custom table form.

Namespace

Drupal\view_custom_table\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $table_name = $form_state
    ->getValue('table_name');
  $this->configEditable
    ->clear($table_name);
  $result = $this->configEditable
    ->save();
  if ($result) {
    drupal_set_message($this
      ->t('@table is removed from views custom table data.', [
      '@table' => $table_name,
    ]));
  }
  else {
    drupal_set_message($this
      ->t('Could not remove table from views view_custom_table.tables, please check log messages for error.'), 'error');
  }
  $form_state
    ->setRedirect('view_custom_table.customtable');
}