You are here

function opigno_dashboard_update_8002 in Opigno dashboard 8

Update Opigno dashboard block label typo.

File

./opigno_dashboard.install, line 62
Install, update and uninstall functions for the alt_aero_log_contacts module.

Code

function opigno_dashboard_update_8002() {
  $connection = \Drupal::database();
  $positioning = $connection
    ->select('opigno_dashboard_positioning', 'p')
    ->fields('p')
    ->execute()
    ->fetchAll();
  if ($positioning) {
    foreach ($positioning as $key => $pos) {
      if (strpos($pos->positions, 'evalueated') !== FALSE) {
        $position = str_replace('evalueated', 'evaluated', $pos->positions);
        try {
          $connection
            ->merge('opigno_dashboard_positioning')
            ->keys([
            'pid' => $pos->pid,
          ])
            ->fields([
            'positions' => $position,
          ])
            ->execute();
        } catch (\Exception $e) {
          \Drupal::logger('opigno_dashboard')
            ->error($e
            ->getMessage());
          \Drupal::messenger()
            ->addMessage($e
            ->getMessage(), 'error');
        }
      }
    }
  }
}