function icon_bundle_overview_form in Icon API 7
Same name and namespace in other branches
- 8 includes/admin.inc \icon_bundle_overview_form()
Menu callback for 'icon_bundle_overview_form'.
1 string reference to 'icon_bundle_overview_form'
- icon_menu in ./
icon.module - Implements hook_menu().
File
Code
function icon_bundle_overview_form($form, &$form_state) {
// Attach UI fonts for Icon API.
$module_path = drupal_get_path('module', 'icon');
$form['#attached'] = array(
'css' => array(
$module_path . '/css/icon.admin.css',
$module_path . '/css/iconapi-embedded.css',
array(
'type' => 'file',
'data' => $module_path . '/css/iconapi-ie7.css',
'browser' => array(
'!IE' => FALSE,
'IE' => 'IE 7',
),
),
),
);
// Determine access to elements based on user permissions.
$admin = user_access('administer icons');
$form['bundles'] = array(
'#tree' => TRUE,
);
foreach (icon_bundles() as $bundle) {
if (!$admin && !$bundle['status']) {
continue;
}
$form['bundles'][$bundle['name']]['#bundle'] = $bundle;
$form['bundles'][$bundle['name']]['status'] = array(
'#access' => $admin,
'#type' => 'checkbox',
'#default_value' => $bundle['status'],
);
}
$form['global'] = array(
'#access' => $admin,
'#type' => 'fieldset',
'#title' => t('Global Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$view_path = variable_get('icon_api_view_path_alias', 'icons');
$form['global']['icon_api_view_path_alias'] = array(
'#type' => 'textfield',
'#title' => t('View Path'),
'#field_prefix' => base_path(),
'#input_group' => TRUE,
'#description' => t('If provided, users with the "view icons" permission will be able to view enabled icons at this URL (defaults to: <code>!path</code>. Change this url if it conflicts with other paths on your site. Leave empty to disable.', array(
'!path' => base_path() . 'icons',
)),
'#default_value' => $view_path,
);
// Show warning message for servers running apache.
$apache_show_warning = $view_path === 'icons' && strpos(drupal_strtolower($_SERVER['SERVER_SOFTWARE']), 'apache') !== FALSE;
$apache_suppress_warning = variable_get('icon_api_apache_suppress_warning', FALSE);
if ($apache_show_warning && !$apache_suppress_warning) {
drupal_set_message(t('<strong>WARNING:</strong> Apache installations are typically configured with a server level alias that redirects "/icons" to an internal directory on the server. It is highly recommended that this be removed from the configuration file for the view path to work properly. If this modification has been made to the server, you may surpress this messages in the global settings below. The only alternative is to change the view path in the global settings below. See: <a href="!link">!link</a>.', array(
'!link' => 'https://drupal.org/node/2198427',
)), 'warning', FALSE);
}
// Provide toggle for suppressing warning message.
$form['global']['icon_api_apache_suppress_warning'] = array(
'#access' => $apache_show_warning,
'#type' => 'checkbox',
'#title' => t('Suppress the Apache server alias warning'),
'#default_value' => $apache_suppress_warning,
);
$form['actions'] = array(
'#access' => $admin,
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}