change library config

This commit is contained in:
Nathan Coad
2016-07-21 12:07:38 +10:00
parent 28df961b87
commit cab49b68f5
2 changed files with 6 additions and 8 deletions

View File

@@ -760,11 +760,10 @@ function booking_node_info() {
/** /**
* Implements hook_library(). * Implements hook_library().
*/ */
/*
function booking_library() { function booking_library() {
$module_path = drupal_get_path('module', 'booking'); $module_path = drupal_get_path('module', 'booking');
$items['stripe'] = array( $items['booking-stripe'] = array(
'title' => t('Stripe'), 'title' => t('Stripe'),
'version' => '1.0', 'version' => '1.0',
'js' => array( 'js' => array(
@@ -775,7 +774,6 @@ function booking_library() {
return $items; return $items;
} }
*/
/** /**
* Implements hook_libraries_info(). * Implements hook_libraries_info().

View File

@@ -44,23 +44,23 @@ function booking_stripeform_form($form, &$form_state) {
form_set_error('form', t('You need to install the stripe library from !link before you can use this form.', form_set_error('form', t('You need to install the stripe library from !link before you can use this form.',
array('!link' => l('here', 'https://stripe.com/docs/libraries')))); array('!link' => l('here', 'https://stripe.com/docs/libraries'))));
} }
//load the main stripe library
libraries_load('stripe');
//set some values for our internal stripe library to help process the form
$setting = array(); $setting = array();
$setting['booking_stripeform'] = array( $setting['booking_stripeform'] = array(
'pubkey' => _booking_get_stripe_public_key(), 'pubkey' => _booking_get_stripe_public_key(),
'form_selector' => str_replace('_', '-', __FUNCTION__), 'form_selector' => str_replace('_', '-', __FUNCTION__),
); );
$form['#attached'] = array( $form['#attached'] = array(
'js' => array( 'js' => array(
array('data' => $setting, 'type' => 'setting'), array('data' => $setting, 'type' => 'setting'),
drupal_get_path('module', 'booking') . '/booking.stripe.js', //drupal_get_path('module', 'booking') . '/booking.stripe.js',
), ),
/*
'library' => array( 'library' => array(
array('booking', 'stripe'), array('booking', 'booking-stripe'),
), ),
*/
); );
$form['stripeToken'] = array( $form['stripeToken'] = array(