function ds_view_modes_list in Display Suite 7
Same name and namespace in other branches
- 7.2 modules/ds_ui/includes/ds.view_modes.inc \ds_view_modes_list()
Shows the list of view modes.
File
- ./
ds.view_modes.inc, line 11 - Administrative functions for managing view modes for every entity.
Code
function ds_view_modes_list() {
$output = '';
ctools_include('export');
$view_modes = ctools_export_crud_load_all('ds_view_modes');
if (!empty($view_modes)) {
$rows = array();
foreach ($view_modes as $view_mode_key => $view_mode_value) {
$row = array();
$row[] = check_plain($view_mode_value->label);
$row[] = $view_mode_key;
$row[] = ucwords(str_replace('_', ' ', implode(', ', $view_mode_value->entities)));
$operations = l(t('Edit'), 'admin/structure/ds/view_modes/manage/' . $view_mode_key, array(
'alias' => TRUE,
));
if ($view_mode_value->export_type == 3) {
$operations .= ' - ' . l(t('Revert'), 'admin/structure/ds/view_modes/revert/' . $view_mode_key, array(
'alias' => TRUE,
));
}
elseif ($view_mode_value->export_type == 1) {
$operations .= ' - ' . l(t('Delete'), 'admin/structure/ds/view_modes/delete/' . $view_mode_key, array(
'alias' => TRUE,
));
}
$row[] = $operations;
$rows[] = $row;
}
$table = array(
'header' => array(
'Label',
'Machine name',
'Entities',
'Operations',
),
'rows' => $rows,
);
$output = theme('table', $table);
}
else {
$output = t('No custom view modes have been defined.');
}
return $output;
}