You are here

function commerce_payment_method_get_title in Commerce Core 7

Returns the title of any or all payment methods.

Parameters

$title: String indicating which title to return, either 'title', 'display_title', or 'short_title'.

$method: Optional parameter specifying the payment method whose title to return.

Return value

Either an array of all payment method titles keyed by the machine name or a string containing the title for the specified type. If a type is specified that does not exist, this function returns FALSE.

4 calls to commerce_payment_method_get_title()
commerce_payment_method_options_list in modules/payment/commerce_payment.module
Wraps commerce_payment_method_get_title() for the Entity module.
commerce_payment_rules_payment_method_options_list in modules/payment/commerce_payment.rules.inc
Returns an options list of available payment methods including a None option.
commerce_payment_tokens in modules/payment/commerce_payment.tokens.inc
Implements hook_tokens().
commerce_payment_ui_form_commerce_payment_ui_add_payment_rule_form_alter in modules/payment/commerce_payment_ui.module
Implements hook_form_FORM_ID_alter().

File

modules/payment/commerce_payment.module, line 629
Defines the payment system and checkout integration.

Code

function commerce_payment_method_get_title($title = 'title', $method = NULL) {
  $payment_methods = commerce_payment_methods();

  // Return a method title if specified and it exists.
  if (!empty($method)) {
    if (isset($payment_methods[$method])) {
      return $payment_methods[$method][$title];
    }
    else {

      // Return FALSE if it does not exist.
      return FALSE;
    }
  }

  // Otherwise create an array of all payment method titles.
  $titles = array();
  foreach ($payment_methods as $key => $value) {
    $titles[$key] = $value[$title];
  }
  return $titles;
}