function commerce_cardonfile_element_options_list in Commerce Card on File 7.2
Returns an options array for selecting a card on file during checkout
Parameters
$stored_cards: An array of stored card data arrays keyed by card_id.
Return value
An options array for selecting a card on file.
2 calls to commerce_cardonfile_element_options_list()
File
- ./
commerce_cardonfile.module, line 791 - Supports card on file functionality for credit card payment methods by associating card data reference IDs from payment gateways with user accounts.
Code
function commerce_cardonfile_element_options_list($stored_cards) {
$options = array();
foreach ($stored_cards as $card_id => $card) {
$replacements = array(
'@card' => $card
->label(),
'@card_exp_month' => str_pad($card->card_exp_month, 2, '0', STR_PAD_LEFT),
'@card_exp_year' => $card->card_exp_year,
);
$options[$card_id] = t('@card, Expires @card_exp_month/@card_exp_year', $replacements);
}
// Add the special option for adding a new card.
$options['new'] = t('Use a different credit card');
return $options;
}