Skip to content

Instantly share code, notes, and snippets.

@mkorostoff
Created September 30, 2014 21:49
Show Gist options
  • Save mkorostoff/700dbe53e4ca64308577 to your computer and use it in GitHub Desktop.
Save mkorostoff/700dbe53e4ca64308577 to your computer and use it in GitHub Desktop.
<?php
/**
* Menu callback for /settings/billing-information/payment-history
*/
function _radius_settings_payment_history_menu_callback() {
$payment_records = array(
array(
"name" => "Rohan",
"payment_method" => "Amex",
),
array(
"name" => "Matt",
"payment_method" => "Visa",
),
array(
"name" => "Eric",
"payment_method" => "Mastercard",
),
);
$page = array(
'content' => theme('payment_history', array('payment_records' => $payment_records)),
);
return $page;
}
<?php
/**
* Implements hook_theme().
*/
function radius_settings_theme() {
//Override the theme default page.tpl.php
return array(
"page__settings" => array(
"template" => "page--settings",
"path" => drupal_get_path('module', 'radius_settings') . '/theme',
),
"settings__account_preferences__prefix" => array(
"template" => "settings--account-preferences--prefix",
"path" => drupal_get_path('module', 'radius_settings') . '/theme',
),
"settings__change_cancel__prefix" => array(
"template" => "settings--change-cancel--prefix",
"path" => drupal_get_path('module', 'radius_settings') . '/theme',
),
"payment_history" => array(
"template" => "payment-history",
"path" => drupal_get_path('module', 'radius_settings') . '/theme',
),
);
}
<!-- payment-history.tpl.php -->
<div>
<div>hello rohan</div>
<?php foreach ($payment_records as $record): ?>
<div class="payment-record">
<?php print $record['name']; ?>
</div>
<div class="payment-method">
<?php print $record['payment_method']; ?>
</div>
<?php endforeach; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment