You are here

function uc_ups_uc_store_status in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 shipping/uc_ups/uc_ups.module \uc_ups_uc_store_status()

Implements hook_uc_store_status().

Lets the administrator know that the UPS account information has not been filled out.

File

shipping/uc_ups/uc_ups.module, line 285
UPS shipping quote module.

Code

function uc_ups_uc_store_status() {
  $messages = [];
  $ups_config = \Drupal::config('uc_ups.settings');
  $access = $ups_config
    ->get('access_license') != '';
  $ups_account = $ups_config
    ->get('shipper_number') != '';
  $user = $ups_config
    ->get('user_id') != '';
  $password = $ups_config
    ->get('password') != '';
  if ($access && $ups_account && $user && $password) {
    $messages[] = [
      'status' => 'ok',
      'title' => t('UPS Online Tools'),
      'desc' => t('Information needed to access UPS Online Tools has been entered.'),
    ];
  }
  else {
    $messages[] = [
      'status' => 'error',
      'title' => t('UPS Online Tools'),
      'desc' => t('More information is needed to access UPS Online Tools. Please enter it <a href=":url">here</a>.', [
        ':url' => Url::fromRoute('uc_ups.settings')
          ->toString(),
      ]),
    ];
  }
  return $messages;
}