stripe.module in Stripe 8
Same filename and directory in other branches
Contains stripe.module.
File
stripe.moduleView source
<?php
/**
* @file
* Contains stripe.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function stripe_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the stripe module.
case 'help.page.stripe':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Stripe') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function stripe_theme() {
return [
'stripe_element' => [
'render element' => 'element',
],
];
}
/**
* Implements hook_page_attachments().
*
* To best leverage Stripe’s advanced fraud functionality, include this script
* on every page on your site, not just the checkout page. This allows Stripe
* to detect anomalous behavior that may be indicative of fraud as users browse
* your web site.
*
* @see https://stripe.com/docs/stripe.js
*/
function stripe_page_attachments(array &$page) {
$page['#attached']['library'][] = 'stripe/stripe';
}
/**
* Implements template_preprocess().
*/
function template_preprocess_stripe_element(&$variables) {
$element =& $variables['element'];
$variables['children'] = $element;
$variables['id'] = $element['#id'];
}
Functions
Name | Description |
---|---|
stripe_help | Implements hook_help(). |
stripe_page_attachments | Implements hook_page_attachments(). |
stripe_theme | Implements hook_theme(). |
template_preprocess_stripe_element | Implements template_preprocess(). |