Ejemplo n.º 1
0
    if (elgg_instanceof($parent, 'object', 'static')) {
        if ($parent->container_guid == $owner->getGUID()) {
            // parent is a top page
            $subpage_relationship_guid = $parent_guid;
        } else {
            // further in the tree, so find out which tree
            $relations = $parent->getEntitiesFromRelationship(['type' => 'object', 'subtype' => StaticPage::SUBTYPE, 'relationship' => 'subpage_of', 'limit' => 1]);
            if ($relations) {
                $subpage_relationship_guid = $relations[0]->getGUID();
            }
        }
        if ($subpage_relationship_guid) {
            // remove old tree relationships
            remove_entity_relationships($entity->getGUID(), 'subpage_of');
            // add new tree relationship
            $entity->addRelationship($subpage_relationship_guid, 'subpage_of');
        }
    }
}
// check the children for the correct tree
if (!$new_entity) {
    static_check_children_tree($entity, $subpage_relationship_guid);
}
$ia = elgg_set_ignore_access(true);
// save all the content
$entity->title = $title;
$entity->description = $description;
$entity->access_id = $access_id;
$entity->container_guid = $parent_guid;
$entity->friendly_title = $friendly_title;
$entity->enable_comments = $enable_comments;