You are here

function payment_page_payment_method_add_select_controller in Payment 7

Shows a page with controllers payment methods can be added for.

Return value

string

1 string reference to 'payment_page_payment_method_add_select_controller'
payment_menu in ./payment.module
Implements hook_menu().

File

./payment.ui.inc, line 235
The Payment user interface.

Code

function payment_page_payment_method_add_select_controller() {
  $controllers = payment_method_controller_load_multiple();
  unset($controllers['PaymentMethodControllerUnavailable']);
  if ($controllers) {
    $items = array();
    foreach ($controllers as $controller) {
      $payment_method = new PaymentMethod(array(
        'controller' => $controller,
      ));
      if (payment_method_access('create', $payment_method)) {
        $items[] = array(
          'title' => $controller->title,
          'href' => 'admin/config/services/payment/method/add/' . $controller->name,
          'description' => $controller->description,
          'localized_options' => array(),
        );
      }
    }
    return theme('admin_block_content', array(
      'content' => $items,
    ));
  }
  else {
    return t('There are no payment method types available. Enable modules that provide them in order to add payment methods.');
  }
}