You are here

function optimizedb_operation_messages in OptimizeDB 8

Status messages after execute commands.

Parameters

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

2 calls to optimizedb_operation_messages()
OptimizedbAdminForm::buildForm in src/Form/OptimizedbAdminForm.php
Form constructor.
OptimizedbListTablesForm::buildForm in src/Form/OptimizedbListTablesForm.php
Form constructor.

File

./optimizedb.module, line 16
Database Optimization.

Code

function optimizedb_operation_messages(array &$form) {
  $operations_tables_result = isset($_SESSION['optimizedb_list_tables_operations']) ? $_SESSION['optimizedb_list_tables_operations'] : NULL;
  if (!is_null($operations_tables_result)) {
    if ($operations_tables_result == []) {
      \Drupal::messenger()
        ->addMessage(t('The operation completed successfully.'));
    }
    else {
      $form['operations_tables'] = [
        '#type' => 'fieldset',
        '#title' => t('Errors that arose during the operation:'),
      ];
      $form['operations_tables']['errors'] = [
        '#markup' => [
          '#theme' => 'table',
          '#header' => [
            [
              'data' => t('Table name'),
            ],
            [
              'data' => t('Type of problem'),
            ],
            [
              'data' => t('Information about the problem'),
            ],
          ],
          '#rows' => $operations_tables_result,
        ],
      ];
    }
  }
  $_SESSION['optimizedb_list_tables_operations'] = NULL;
}