function context_addassets_admin in Context Add Assets 7
Same name and namespace in other branches
- 6 context_addassets.module \context_addassets_admin()
Admin Config Page (admin/build/context/add-assets)
1 string reference to 'context_addassets_admin'
- context_addassets_menu in ./
context_addassets.module - Implements hook_menu().
File
- ./
context_addassets.module, line 52
Code
function context_addassets_admin() {
// Add AddAssets Admin Assets (css)
$css = drupal_get_path('module', 'context_addassets') . "/css/context_addassets-admin.css";
drupal_add_css($css, 'theme', 'all', TRUE);
$modules = module_list();
asort($modules);
foreach ($modules as $key => $value) {
$index = drupal_get_path('module', $value);
$modules[$index] = $value;
unset($modules[$key], $index);
}
$form['description'] = array(
'#markup' => t('By default Context Add Assets indexes your active themes, you can increase the locations that are indexed below.'),
);
$form['modules'] = array(
'#type' => 'fieldset',
'#title' => 'Index Module Assets',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['modules']['context_addassets_index_modules'] = array(
'#type' => 'checkboxes',
'#title' => 'Include Selected Module Assets',
'#options' => $modules,
'#default_value' => variable_get('context_addassets_index_modules', array()),
);
$form['paths'] = array(
'#type' => 'fieldset',
'#title' => 'Index Path Assets',
'#description' => t('Add file paths below to have them indexed by Add Assets. Note that paths should be relative to root of Drupal installation and <em>not include a leading/trailing slash</em>.<p><strong>Example:</strong> sites/all/libraries/my-custom-libraries</p>'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Initialize path array index at zero.
$path_index = 0;
// Build form elements for existing path_index vars
while ($path = variable_get('context_addassets_index_path' . $path_index, NULL)) {
$form['paths']['context_addassets_index_path' . $path_index] = array(
'#type' => 'textfield',
'#title' => 'Path',
'#default_value' => $path,
);
$path_index += 1;
}
// Set how many empty forms to show
$path_add_at_time = 1;
// Set loop end (based on path_add_at_time)
$end = $path_index + $path_add_at_time - 1;
//-1 for 0 indexed array
while ($path_index <= $end) {
$form['paths']['context_addassets_index_path' . $path_index] = array(
'#type' => 'textfield',
'#title' => 'Path',
);
$path_index += 1;
}
return system_settings_form($form);
}