function relation_ui_type_list in Relation 7
List all relation_types (page callback).
1 string reference to 'relation_ui_type_list'
- relation_ui_menu in ./
relation_ui.module - Implements hook_menu().
File
- ./
relation_ui.module, line 139 - Provide administration interface for relation type bundles.
Code
function relation_ui_type_list() {
$relation = relation_entity_info();
$field_ui = module_exists('field_ui');
$ctools = module_exists('ctools');
$ops_count = 2 + 2 * $field_ui + $ctools;
$headers = array(
array(
'data' => t('Name'),
'width' => '40%',
),
array(
'data' => t('Operations'),
'colspan' => $ops_count,
),
);
$rows = array();
foreach ($relation['relation']['bundles'] as $type => $relation_type) {
$url = 'admin/structure/relation/manage/' . $type;
$row = array(
l($relation_type['label'], $url),
);
$row[] = l(t('edit'), $url . '/edit');
if ($field_ui) {
$row[] = l(t('manage fields'), $url . '/fields');
$row[] = l(t('display fields'), $url . '/display');
}
if ($ctools) {
$row[] = l(t('export'), $url . '/export');
}
$row[] = empty($relation_type->in_code_only) ? l(t('delete'), $url . '/delete') : ' ';
$rows[] = $row;
}
$output = array(
'#theme' => 'table',
'#header' => $headers,
'#rows' => $rows,
'#empty' => t('No relationship types available.', array(
'@link' => l(t('Add relationship type'), url('admin/structure/relation/add')),
)),
);
return $output;
}