You are here

function payment_commerce_commerce_payment_method_info in Payment for Drupal Commerce 7

Same name and namespace in other branches
  1. 7.2 payment_commerce.module \payment_commerce_commerce_payment_method_info()

Implements hook_commerce_payment_method_info().

File

./payment_commerce.module, line 62
Hook implementations and shared functions.

Code

function payment_commerce_commerce_payment_method_info() {
  $payment_methods = array();

  // Use this low level query to ensure we don't trigger an entity_get_info()
  // call as this function is triggered within a call to entity_get_info().
  // Nesting entity_get_info() calls can lead to unpredictable cache states.
  $query = db_select('payment_method', 'pm');
  $query
    ->fields('pm')
    ->condition('pm.enabled', 1);
  $payment_method_rows = $query
    ->execute()
    ->fetchAll(PDO::FETCH_OBJ);
  foreach ($payment_method_rows as $payment_method) {
    $payment_methods['payment_commerce_' . $payment_method->pmid] = array(
      'base' => 'payment_commerce',
      'title' => t('!title (Payment)', array(
        '!title' => $payment_method->title_specific,
      )),
      'display_title' => $payment_method->title_generic,
      'short_title' => $payment_method->title_generic,
      'active' => TRUE,
      'offsite' => TRUE,
      'terminal' => FALSE,
    );
  }
  return $payment_methods;
}