function _fieldable_panels_panes_admin_title_from_entity in Fieldable Panels Panes (FPP) 7
Gets the admin title from the entity.
2 calls to _fieldable_panels_panes_admin_title_from_entity()
- fieldable_panels_panes_fieldable_panels_pane_content_type_admin_title in plugins/
content_types/ fieldable_panels_pane.inc - Callback to provide the administrative title of the custom content.
- _fieldable_panels_panes_custom_content_type in plugins/
content_types/ fieldable_panels_pane.inc - Return an info array for a specific custom content type.
File
- plugins/
content_types/ fieldable_panels_pane.inc, line 209 - CTools content type to render a fielded panel pane.
Code
function _fieldable_panels_panes_admin_title_from_entity($entity) {
if (!empty($entity) && is_object($entity)) {
$title = array();
// Start with the entity bundle label.
$info = entity_get_info('fieldable_panels_pane');
if (!empty($info['bundles'][$entity->bundle]['label'])) {
$title[] = $info['bundles'][$entity->bundle]['label'];
}
// Add the admin title, if it isn't the same as what was returned above.
if (!empty($entity->admin_title)) {
if (!in_array(trim($entity->admin_title), $title)) {
$title[] = trim($entity->admin_title);
}
}
elseif (!empty($entity->title)) {
if (!in_array(trim($entity->title), $title)) {
$title[] = trim($entity->title);
}
}
// Make sure no XSS strings go through the title.
$title = filter_xss(implode(': ', $title));
// Indicate when the FPP is reusable.
if (!empty($entity->reusable)) {
$title .= ' (' . t('reusable') . ')';
}
}
else {
$title = t('Deleted/removed entity pane');
}
return $title;
}