function ds_layout_list in Display Suite 7
Same name and namespace in other branches
- 7.2 includes/ds.displays.inc \ds_layout_list()
Menu callback: Show the layout list.
File
- ./
ds.layout.inc, line 11 - Shows the overview screen with all links to entities.
Code
function ds_layout_list() {
$build = array();
// All entities.
$rows = array();
$entities = entity_get_info();
foreach ($entities as $entity_type => $entity) {
if (isset($entity['fieldable']) && $entity['fieldable'] || isset($entity['ds_display'])) {
$entity_rows = array();
foreach ($entity['bundles'] as $bundle_type => $bundle) {
$row = array();
$path = isset($bundle['admin']['real path']) ? $bundle['admin']['real path'] : (isset($bundle['admin']['path']) ? $bundle['admin']['path'] : '');
if (empty($path)) {
continue;
}
$row[] = check_plain($bundle['label']);
$links = array(
l(t('Manage display'), $path . '/display'),
);
if ($entity['base table'] == 'node' && (module_exists('ds_forms') && !module_exists('rel'))) {
$links[] = l(t('Manage form'), $path . '/fields');
}
$row[] = implode(' - ', $links);
$entity_rows[] = $row;
}
if (!empty($entity_rows)) {
$rows[] = array(
array(
'data' => $entity['label'],
'colspan' => '2',
'style' => 'background-color: #E1E2DC; border: 1px solid #BEBFB9;',
),
);
$rows = array_merge($rows, $entity_rows);
}
}
}
if (!empty($rows)) {
$variables = array(
'header' => array(),
'rows' => $rows,
);
$build['list'] = array(
'#markup' => theme('table', $variables),
);
}
else {
// This will probably never happen.
$build['list'] = array(
'#markup' => t('No content found'),
);
}
return $build;
}