function fieldable_panels_panes_load_from_subtype in Fieldable Panels Panes (FPP) 7
Properly load the FPP entity via its subtype.
Parameters
string $subtype_name: A string combining an indicator of the type of ID, e.g. 'fpid', 'vid' or 'vuuid', and an integer ID, separated by a colon; e.g. "fpid:123".
Return value
object|bool The requested FPP object, FALSE otherwise.
4 calls to fieldable_panels_panes_load_from_subtype()
- 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_fieldable_panels_pane_content_type_content_type in plugins/
content_types/ fieldable_panels_pane.inc - Callback to return the custom content types with the specified $subtype_name.
- fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form in plugins/
content_types/ fieldable_panels_pane.inc - Form used to edit our content type.
- fieldable_panels_panes_fieldable_panels_pane_content_type_render in plugins/
content_types/ fieldable_panels_pane.inc - Callback to render our content type.
File
- ./
fieldable_panels_panes.module, line 989 - Maintains an entity that appears as panel pane content.
Code
function fieldable_panels_panes_load_from_subtype($subtype_name) {
ctools_include('content');
$plugin = ctools_get_content_type('fieldable_panels_pane');
// Next, check to see how the subtype is configured.
$subtype_info = ctools_content_get_subtype($plugin, $subtype_name);
// If the FPP type doesn't exist then fail.
if (!isset($subtype_info['bundle'])) {
return FALSE;
}
// This means we're probably in the process of creating a new one.
if (!isset($subtype_info['entity_id'])) {
return fieldable_panels_panes_create(array(
'bundle' => $subtype_info['bundle'],
));
}
// And try it this way.
if (isset($subtype_info['entity_id'])) {
return fieldable_panels_panes_load_from_subtype_force($subtype_info['entity_id']);
}
// Finally, try this:
return fieldable_panels_panes_load_from_subtype_force($subtype_name);
}