function pay::save in Pay 7
Same name and namespace in other branches
- 6 includes/handlers/pay.inc \pay::save()
6 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_method::disable in includes/
handlers/ pay_method.inc - Disable this payment method.
File
- includes/
handlers/ pay.inc, line 300 - 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 ? array() : $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);
}
}