You are here

public function OptimizedbListTablesForm::submitForm in OptimizeDB 8

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/OptimizedbListTablesForm.php, line 135

Class

OptimizedbListTablesForm
Operations with tables.

Namespace

Drupal\optimizedb\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $tables = $form_state
    ->getValue('tables');
  $operation = '';
  $op = (string) $form_state
    ->getValue('op');
  switch ($op) {

    // Checking the selected tables to find errors.
    case $this
      ->t('Check tables'):
      $operation = 'CHECK TABLE';
      break;

    // Repair selected tables.
    case $this
      ->t('Repair tables'):
      $operation = 'REPAIR TABLE';
      break;

    // Optimization of the selected tables.
    case $this
      ->t('Optimize tables'):
      $operation = 'OPTIMIZE TABLE';
      break;
  }
  _optimizedb_list_tables_operation_execute($tables, $operation);
}