You are here

function pay_forms in Pay 6

List available payment forms.

2 calls to pay_forms()
pay_node_admin_node_form_alter in modules/pay_node/includes/pay_node.admin.inc
A form_alter helper for node creation forms.
pay_node_admin_node_type_form_alter in modules/pay_node/includes/pay_node.admin.inc

File

./pay.module, line 398
Pay module allows for accepting payments using pluggable payment backends.

Code

function pay_forms($handler = NULL, $embeddable = NULL, $status = 1) {
  $where = $args = array();
  if (!is_null($handler)) {
    $where[] = "handler = '%s'";
    $args[] = $handler;
  }
  if (!is_null($status)) {
    $where[] = "status = %d";
    $args[] = $status;
  }
  if (!is_null($embeddable)) {
    $where[] = "embeddable = %d";
    $args[] = $embeddable;
  }
  $sql = "SELECT * FROM {pay_form}";
  if ($where) {
    $sql .= ' WHERE ' . join(' AND ', $where);
  }
  $sql .= " ORDER BY title";
  $forms = array();
  $res = db_query($sql, $args);
  while ($row = db_fetch_object($res)) {
    if ($pay_form = pay_form_load($row)) {
      $forms[$row->pfid] = $pay_form;
    }
  }
  return $forms;
}