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