function uniform_init in Uniform 7.2
Same name and namespace in other branches
- 6 uniform.module \uniform_init()
- 7 uniform.module \uniform_init()
Implements hook_init().
File
- ./
uniform.module, line 109 - Module for displaying sexy forms using jQuery. This module uses jQuery to theme html forms.
Code
function uniform_init() {
$enabled = variable_get('uniform_elements', array());
$go = current($enabled);
if (!empty($go)) {
$path = libraries_get_path('uniform');
$modpath = drupal_get_path('module', 'uniform');
// load theme css
drupal_add_css($path . '/themes/' . variable_get('uniform_theme', 'default') . '/css/uniform.' . variable_get('uniform_theme', 'default') . '.css');
drupal_add_css($modpath . '/uniform.css');
// load uniform js file, chosing minified version if present.
if (file_exists($path . '/jquery.uniform.min.js')) {
drupal_add_js($path . '/jquery.uniform.min.js');
}
else {
drupal_add_js($path . '/jquery.uniform.js');
}
//Only Show uniform in Admin section or on node add/edit forms if allowed
if (variable_get('uniform_admin', 'su') != 'su' && arg(0) == 'admin' || variable_get('uniform_node', 'su') != 'su' && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == "edit") || variable_get('uniform_admin', 'su') != 'su' && arg(1) == 'ajax') {
}
else {
// add script to enable theming of elements defined in settings
$uniform_selectors = array(
'selectors' => array_keys(array_filter($enabled)),
);
$not_selectors = variable_get('uniform_not_selectors', '');
if (!empty($not_selectors)) {
$uniform_selectors['not'] = filter_xss_admin($not_selectors);
}
drupal_add_js(array(
'uniform' => $uniform_selectors,
), 'setting');
drupal_add_js($modpath . '/uniform.js', array(
'scope' => 'footer',
));
}
}
}