function hide_submit_attach_js_css in Hide submit button 7.2
Adds the JS and CSS to the form.
2 calls to hide_submit_attach_js_css()
- hide_submit_after_build in ./
hide_submit.module - After build form callback.
- hide_submit_form_alter in ./
hide_submit.module - Implements hook_form_alter().
File
- ./
hide_submit.module, line 64 - This module blocks users from accidentally submitting a form twice. The protection only comes from jQuery and is not server side, so this is only effective against accidentally clicking of the button by users with Javascript enabled (which is a very…
Code
function hide_submit_attach_js_css(&$form) {
// Add JavaScript.
if (!isset($form['#attached']['js'])) {
$form['#attached']['js'] = array();
}
$form['#attached']['js'][drupal_get_path('module', 'hide_submit') . '/js/hide_submit.js'] = array(
'type' => 'file',
'weight' => 10,
);
if (variable_get('hide_submit_method') == 'indicator') {
$form['#attached']['js'][drupal_get_path('module', 'hide_submit') . '/js/spin.min.js'] = array(
'type' => 'file',
'weight' => 11,
);
$form['#attached']['js'][drupal_get_path('module', 'hide_submit') . '/js/ladda.min.js'] = array(
'type' => 'file',
'weight' => 12,
);
}
// Add CSS.
if (!isset($form['#attached']['css'])) {
$form['#attached']['css'] = array();
}
if (variable_get('hide_submit_method') == 'indicator') {
$form['#attached']['css'][drupal_get_path('module', 'hide_submit') . '/css/ladda-themeless.min.css'] = array(
'type' => 'file',
'weight' => 9,
);
}
$form['#attached']['css'][drupal_get_path('module', 'hide_submit') . '/css/hide_submit.css'] = array(
'type' => 'file',
'weight' => 10,
);
}