You are here

function uc_store_token_values in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_store/uc_store.module \uc_store_token_values()

Implements hook_token_values(). (token.module)

1 call to uc_store_token_values()
template_preprocess_uc_packing_slip in shipping/uc_shipping/uc_shipping.module

File

uc_store/uc_store.module, line 440
Contains global Ubercart functions and store administration functionality.

Code

function uc_store_token_values($type, $object = NULL) {
  global $theme_key;
  $values = array();
  switch ($type) {
    case 'global':
      $login_link = url('user', array(
        'absolute' => TRUE,
      ));
      $values['site-login'] = l($login_link, $login_link);

      // The site logo is available through theme_get_setting(), but calling
      // it here may incorrectly initialise the static cache.
      $settings = theme_get_settings($theme_key);
      $themes = list_themes();
      $theme_object = $themes[$theme_key];
      if ($settings['toggle_logo']) {
        if ($settings['default_logo']) {
          $logo = dirname($theme_object->filename) . '/logo.png';
        }
        elseif ($settings['logo_path']) {
          $logo = $settings['logo_path'];
        }
      }

      // Use a logo; but only if we have one to use.
      if (!empty($logo)) {
        $values['site-logo'] = theme('image', url($logo, array(
          'absolute' => TRUE,
        )), '', '', NULL, FALSE);
      }
      else {
        $values['site-logo'] = '';
      }
      $values['store-name'] = variable_get('uc_store_name', t('Our store'));
      $values['store-url'] = url('<front>', array(
        'absolute' => TRUE,
      ));
      $values['store-link'] = l(variable_get('uc_store_name', t('Our store')), '<front>', array(
        'absolute' => TRUE,
      ));
      $values['store-owner'] = variable_get('uc_store_owner', '');
      $values['store-email'] = uc_store_email();
      $values['store-phone'] = variable_get('uc_store_phone', '');
      $values['store-fax'] = variable_get('uc_store_fax', '');
      $values['store-address'] = uc_store_address();
      $values['store-help-url'] = url(variable_get('uc_store_help_page', ''), array(
        'absolute' => TRUE,
      ));
      break;
  }
  return $values;
}