You are here

function pay_admin_overview in Pay 6

Same name and namespace in other branches
  1. 7 includes/pay.admin.inc \pay_admin_overview()

Payment settings overview.

1 string reference to 'pay_admin_overview'
pay_menu_menu in includes/pay.menu.inc
Implementation of hook_menu().

File

includes/pay.admin.inc, line 11
Administration form settings and related functions.

Code

function pay_admin_overview() {
  $output = '';
  $output .= drupal_get_form('pay_admin_settings');
  $hdrs = array(
    t('Label'),
    t('Handler'),
    t('Operations'),
  );
  $info = pay_handlers('pay_method');
  foreach (pay_form_load()
    ->pay_method_list() as $pmid => $pay_method) {
    if (!($pay_method = pay_method_load($pmid))) {
      continue;
    }
    $rows[] = array(
      $pay_method
        ->title(),
      $info[$pay_method
        ->handler()]['title'],
      l(t('edit'), 'admin/settings/pay/' . $pmid . '/edit'),
    );
  }
  if ($rows) {
    $output .= '<h3>' . t('Payment methods') . '</h3>';
    $output .= theme('table', $hdrs, $rows);
  }
  else {
    drupal_set_message(t('You need at least one payment method before you can accept payments on your site. You can add a payment method !add_url.', array(
      '!add_url' => l(t('here'), 'admin/settings/pay/add'),
    )), 'warning');
  }
  return $output;
}