View source
<?php
function commerce_sagepay_paypal_commerce_payment_method_info() {
$payment_methods = array();
$payment_methods['commerce_sagepay_paypal'] = array(
'base' => 'commerce_sagepay_paypal',
'title' => t('SagePay PayPal Integration'),
'display_title' => t('PayPal'),
'short_title' => t('PayPal'),
'description' => t('Integration with PayPal using Sage Pay Direct.'),
'active' => FALSE,
'terminal' => FALSE,
'offsite' => TRUE,
'offsite_autoredirect' => TRUE,
'callbacks' => array(),
'file' => 'includes/commerce_sagepay_paypal.inc',
);
return $payment_methods;
}
function commerce_sagepay_paypal_menu() {
$items = array();
$items['commerce-sagepay/paypal-callback/%'] = array(
'page callback' => 'commerce_sagepay_paypal_handle_callback',
'page arguments' => array(
2,
),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'file' => 'includes/commerce_sagepay_paypal.inc',
);
return $items;
}
function commerce_sagepay_paypal_theme($existing, $type, $theme, $path) {
return array(
'commerce_sagepay_paypal_card_logo' => array(
'variables' => array(
'name' => NULL,
'img' => NULL,
'href' => NULL,
),
),
);
}
function theme_commerce_sagepay_paypal_card_logo($variables) {
$output = '';
if (!empty($variables['img'])) {
$src = $variables['img'];
}
else {
$src = '/' . drupal_get_path('module', 'commerce_sagepay_paypal');
$src .= '/img/paypal.gif';
}
$img = '<img src="' . $src . '" />';
if (!empty($variables['href'])) {
$output .= l($img, $variables['href'], array(
'html' => TRUE,
));
}
else {
$output .= $img;
}
return $output;
}