function organigrams_item_get_parent in Organigrams 7
Find parent of a given organigrams item ID.
Parameters
int $iid: An organigrams item ID.
Return value
mixed An organigrams item object if the parent exists, otherwise NULL.
1 call to organigrams_item_get_parent()
- organigrams_form_organigrams_item in ./
organigrams_item.admin.inc - Create or edit form for an organigrams item.
File
- ./
organigrams.module, line 1854 - Defines the organigrams functions and entity types.
Code
function organigrams_item_get_parent($iid) {
$parent_organigrams_item = NULL;
// Try to load the organigrams item and check if the parent contains a value.
// (Remember 0 is no parent).
if (($organigrams_item = organigrams_item_load($iid)) !== NULL && !empty($organigrams_item->parent)) {
// Try to load the organigrams item parent.
$parent_organigrams_item = organigrams_item_load($organigrams_item->parent);
}
return $parent_organigrams_item;
}