You are here

function commerce_cop_admin_overview in Commerce Custom Offline Payments 7

Returns an administrative overview of all custom offline payments.

Return value

string A HTML-formatted string with the administrative payment content.

See also

commerce_cop_menu()

1 string reference to 'commerce_cop_admin_overview'
commerce_cop_menu in ./commerce_cop.module
Implements hook_menu().

File

./commerce_cop.admin.inc, line 17
Custom offline payment methods for Drupal Commerce.

Code

function commerce_cop_admin_overview() {
  $rows = array();
  foreach (commerce_cop_get_payments() as $payment) {

    // Build the operation links for the current item.
    $links = menu_contextual_links('commerce-cop-' . $payment['id'], 'admin/commerce/config/custom-offline-payments', array(
      $payment['id'],
    ));
    $rows[] = array(
      $payment['title'],
      $payment['status'] ? t('Enabled') : t('Disabled'),
      theme('links', array(
        'links' => $links,
        'attributes' => array(
          'class' => 'links inline operations',
        ),
      )),
    );
  }
  if (empty($rows)) {
    return t('No custom offline payments are defined.');
  }
  else {
    $headers = array(
      t('Payment'),
      t('Status'),
      t('Operations'),
    );
    return theme('table', array(
      'header' => $headers,
      'rows' => $rows,
      'empty' => t('No books available.'),
    ));
  }
}