function ctools_entity_form_field_content_type_admin_title
Returns the administrative title for a type.
File
-
plugins/
content_types/ form/ entity_form_field.inc, line 154
Code
function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $context) {
// Return early because we don't have context to build this field from.
if (!$context || !isset($context->identifier)) {
watchdog('ctools_entity_form_field_content_type_admin_title', 'Context is missing for field: @name', array(
'@name' => $subtype,
), WATCHDOG_NOTICE);
return t('Deleted/missing field @name', array(
'@name' => $subtype,
));
}
list($entity_type, $field_name) = explode(':', $subtype, 2);
if (!empty($context->restrictions)) {
$field = field_info_instance($entity_type, $field_name, $context->restrictions['type'][0]);
// Check for field groups.
if (empty($field) && module_exists('field_group')) {
$groups = field_group_info_groups($entity_type, $context->restrictions['type'][0], 'form');
$group = !empty($groups[$field_name]) ? $groups[$field_name] : NULL;
$field = array(
'label' => isset($group->label) ? $group->label : $subtype,
);
}
}
else {
$field = array(
'label' => $subtype,
);
}
return t('"@s" @field form', array(
'@s' => $context->identifier,
'@field' => $field['label'],
));
}