function views_foundation_config_form in Views Foundation 7
Same name and namespace in other branches
- 7.4 views_foundation.admin.inc \views_foundation_config_form()
Function to build Views Foundation admin settings form.
1 string reference to 'views_foundation_config_form'
- views_foundation_menu in ./
views_foundation.module - Implements hook_menu().
File
- ./
views_foundation.admin.inc, line 11 - Administration page for Views Foundation settings.
Code
function views_foundation_config_form($form, &$form_state) {
$js_path = variable_get('views_foundation_js', '');
// Array of known themes and path to JavaScripts.
$themes = array(
'zurb_foundation' => '/js',
'zoundation' => '/javascripts/foundation',
'cogito' => '/foundation/javascripts/foundation',
);
if (module_exists('libraries') && ($libraries_path = libraries_get_path('foundation'))) {
$foundation_paths['libraries'] = $libraries_path . '/javascripts';
}
// We need JQuery 1.7 or higher for Foundation features to working properly.
$jquery = drupal_get_library('system', 'jquery');
if (version_compare($jquery['version'], '1.7', '<')) {
drupal_set_message(t('Views Foundation requires jQuery 1.7 or higher. !configure to use a higher jQuery version.', array(
'!configure' => l(t('Configure jQuery Update'), 'admin/config/media/views_foundation'),
)), 'error', FALSE);
}
// Find directories in the known places.
foreach ($themes as $key => $value) {
$theme_path = drupal_get_path('theme', $key) . $value;
if (is_dir($theme_path)) {
$foundation_paths[$key] = $theme_path;
}
}
$foundation_paths['custom path'] = '';
if (is_dir($js_path)) {
// Add information about the current path.
$form['views_foundation_heading'] = array(
'#markup' => '<h4>' . t('Current Zurb Foundation JavaScripts path: "@path".', array(
'@path' => $js_path,
)) . '</h4>',
);
}
$form['views_foundation_js'] = array(
'#type' => 'radios',
'#title' => t('Foundation library path'),
'#options' => array_flip($foundation_paths),
'#description' => t('Select your preferred location of the Zurb Foundation library.'),
'#default_value' => in_array($js_path, $foundation_paths) ? $js_path : '',
);
$form['views_foundation_custom'] = array(
'#type' => 'textfield',
'#title' => t('Custom path.'),
'#default_value' => in_array($js_path, $foundation_paths) ? '' : $js_path,
'#description' => t('Specify a path to the Zurb Foundation JavaScripts directory.'),
);
return system_settings_form($form);
}