function pay::save in Pay 6
Same name and namespace in other branches
- 7 includes/handlers/pay.inc \pay::save()
5 calls to pay::save()
- pay::disable in includes/
handlers/ pay.inc - pay::enable in includes/
handlers/ pay.inc - pay::settings_form_submit in includes/
handlers/ pay.inc - pay_activity::do_activity in includes/
handlers/ pay_activity.inc - Effect a payment action using the currently-selected payment method.
- pay_transaction::update_status in includes/
handlers/ pay_transaction.inc
File
- includes/
handlers/ pay.inc, line 267 - The base class for the Payment API.
Class
- pay
- @file The base class for the Payment API.
Code
function save($values = array()) {
$this
->__construct($values);
$settings = (array) $this;
$exclude = array(
'key',
'table',
'form_values',
);
if (isset($this->table)) {
$schema = drupal_get_schema($this->table);
$settings = (array) $this;
foreach ($this as $key => $val) {
if (isset($schema['fields'][$key]) || in_array($key, $exclude)) {
unset($settings[$key]);
}
}
$this->settings = $settings;
$this->handler = get_class($this);
$this->new = isset($this->{$this->key}) ? FALSE : TRUE;
$update = $this->new ? NULL : $this->key;
// Save this item.
drupal_write_record($this->table, $this, $update);
// Invoke a Drupal hook based on the table name (e.g. pay_form_create).
$hook = $this->new ? '_create' : '_update';
$this
->drupal_invoke($this->table . $hook, $values);
}
}