function skinr_ui_admin_skins in Skinr 7.2
Same name and namespace in other branches
- 6.2 skinr_ui.admin.inc \skinr_ui_admin_skins()
Form builder: Builds the skin configuration administration overview.
2 calls to skinr_ui_admin_skins()
- skinr_context_ui_admin_skin_list in skinr_context/
skinr_context_ui.admin.inc - Overrides skinr_ui_list().
- skinr_ui_list in ./
skinr_ui.admin.inc - Menu callback: skin configurations administration.
File
- ./
skinr_ui.admin.inc, line 431 - Admin page callbacks for the Skinr UI module.
Code
function skinr_ui_admin_skins($header, $skins) {
// Build the 'Update options' form.
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$options = array();
foreach (module_invoke_all('skinr_ui_operations') as $operation => $array) {
$options[$operation] = $array['label'];
}
$form['options']['operation'] = array(
'#type' => 'select',
'#title' => t('Operation'),
'#title_display' => 'invisible',
'#options' => $options,
'#default_value' => 'enable',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#validate' => array(
'skinr_ui_admin_skins_validate',
),
'#submit' => array(
'skinr_ui_admin_skins_submit',
),
);
$themes = list_themes();
$skin_info = skinr_get_skin_info();
$destination = drupal_get_destination();
$options = array();
foreach ($skins as $skin) {
$operations = array();
$operations['edit'] = array(
'title' => t('edit'),
'href' => 'admin/structure/skinr/edit/' . $skin->module . '/' . $skin->element,
'query' => $destination,
);
$operations['status'] = array(
'title' => $skin->status ? t('disable') : t('enable'),
'href' => 'admin/structure/skinr/skin/' . $skin->sid . '/' . ($skin->status ? 'disable' : 'enable'),
'query' => $destination + array(
'token' => drupal_get_token('admin/structure/skinr/skin/' . $skin->sid . '/' . ($skin->status ? 'disable' : 'enable')),
),
);
$storage = skinr_ui_skin_storage($skin);
if ($storage == t('Overridden')) {
$operations['revert'] = array(
'title' => t('revert'),
'href' => 'admin/structure/skinr/skin/' . $skin->sid . '/revert',
'query' => $destination,
);
}
if ($storage == t('Normal')) {
$operations['delete'] = array(
'title' => t('delete'),
'href' => 'admin/structure/skinr/skin/' . $skin->sid . '/delete',
'query' => $destination,
);
}
$title = skinr_ui_get_element_title($skin->module, $skin->element, $skin->theme);
$options[$skin->sid] = array(
'#skin' => $skin,
'theme' => isset($themes[$skin->theme]) ? $themes[$skin->theme]->info['name'] : '<em>' . $skin->theme . '</em>',
'type' => $skin->module,
'element' => $title ? $title : $skin->element,
'skin' => $skin->skin == '_additional' ? '<em>' . t('Additional classes') . '</em>' : (isset($skin_info[$skin->skin]) ? $skin_info[$skin->skin]['title'] : '<em>' . $skin->skin . '</em>'),
'status' => $skin->status ? t('enabled') : t('disabled'),
'storage' => array(
'data' => $storage,
'class' => array(
'skinr-ui-storage',
),
),
'operations' => array(
'data' => array(
'#theme' => 'links__skinr_ui_operations',
'#links' => $operations,
'#attributes' => array(
'class' => array(
'links',
'inline',
),
),
),
),
);
if (!$skin->status) {
$options[$skin->sid]['#attributes'] = array(
'class' => array(
'skinr-ui-disabled',
),
);
}
}
// Hide status row. Only used for sorting.
unset($header['status']);
drupal_add_css(drupal_get_path('module', 'skinr_ui') . '/css/skinr-ui-admin.css');
$form['skins'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#empty' => t('No content available.'),
);
$form['pager'] = array(
'#markup' => theme('pager'),
);
return $form;
}