You are here

function uc_role_uc_store_status in Ubercart 8.4

Implements hook_uc_store_status().

File

uc_role/uc_role.module, line 388
Grants roles upon accepted payment of products.

Code

function uc_role_uc_store_status() {
  $message = [];
  $role_choices = _uc_role_get_choices();
  if (empty($role_choices)) {
    $message[] = [
      'status' => 'warning',
      'title' => t('Roles'),
      'desc' => t('There are no product role(s) that can be assigned upon product purchase. Set product roles in the <a href=":url">product settings</a> under the role assignment settings tab.', [
        ':url' => Url::fromRoute('uc_product.settings')
          ->toString(),
      ]),
    ];
  }
  else {
    $message[] = [
      'status' => 'ok',
      'title' => t('Roles'),
      'desc' => t('The role(s) %roles are set to be used with the Role Assignment product feature.', [
        '%roles' => implode(', ', $role_choices),
      ]),
    ];
  }
  return $message;
}