本文整理汇总了PHP中ElggObject::getContainerEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggObject::getContainerEntity方法的具体用法?PHP ElggObject::getContainerEntity怎么用?PHP ElggObject::getContainerEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggObject
的用法示例。
在下文中一共展示了ElggObject::getContainerEntity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tidypics_2012111901
/**
* Change the tidypics_batch's access_id to container's access_id (album object)
*
* @param ElggObject $entity
* @param string $getter
* @param array $options
*/
function tidypics_2012111901($entity, $getter, $options)
{
$album = $entity->getContainerEntity();
if ($guid = tidypics_adjust_batch_access_id($entity, $album)) {
return $guid;
}
}
示例2: createObject
/**
* Make sure we can autosubscribe the user to further updates
*
* @param string $event the name of the event
* @param string $type the type of the event
* @param ElggObject $object the created comment
*
* @return void
*/
public static function createObject($event, $type, \ElggObject $object)
{
if (!$object instanceof \ElggComment) {
return;
}
$owner = $object->getOwnerEntity();
$entity = $object->getContainerEntity();
// add auto subscription for this user
content_subscriptions_autosubscribe($entity->getGUID(), $owner->getGUID());
}
示例3: createCommentOnAnswer
/**
* Subscribe to a question when you create a comment on an answer
*
* @param string $event
* @param string $type
* @param \ElggObject $object
*
* @return void
*/
public static function createCommentOnAnswer($event, $type, \ElggObject $object)
{
if (!elgg_is_active_plugin('content_subscriptions')) {
return;
}
if (!$object instanceof \ElggComment) {
return;
}
$answer = $object->getContainerEntity();
if (!$answer instanceof \ElggAnswer) {
return;
}
$owner = $object->getOwnerEntity();
$question = $answer->getContainerEntity();
if (!content_subscriptions_can_subscribe($question, $owner->getGUID())) {
return;
}
// subscribe to the question
content_subscriptions_autosubscribe($question->getGUID(), $owner->getGUID());
}
示例4: file_tools_get_parent_url
function file_tools_get_parent_url(ElggObject $folder)
{
if ($folder->parent_guid !== 0) {
$parent = get_entity($folder->parent_guid);
return file_tools_folder_url_handler($parent);
} else {
$container = $folder->getContainerEntity();
if (elgg_instanceof($container, "group")) {
return "file/group/" . $container->getGUID() . "/all";
} else {
return "file/owner/" . $container->username;
}
}
}
示例5: forward
if ($guid) {
$entity = get_entity($guid);
if (!elgg_instanceof($entity, 'object', 'chat_message') || !$entity->canEdit()) {
register_error(elgg_echo('noaccess'));
forward(REFERER);
}
} else {
$entity = new ElggObject();
$entity->subtype = 'chat_message';
$entity->access_id = ACCESS_LOGGED_IN;
$entity->container_guid = $container_guid;
}
$entity->description = $message;
if ($entity->save()) {
elgg_clear_sticky_form('chat_message');
$chat = $entity->getContainerEntity();
$members = $chat->getMemberEntities();
foreach ($members as $member) {
// No unread annotations for user's own message
if ($member->getGUID() === $user->getGUID()) {
continue;
}
// Mark the message as unread
$entity->addRelationship($member->getGUID(), 'unread');
// Add number of unread messages also to the chat object
$chat->increaseUnreadMessageCount($member);
}
// @todo Should we update the container chat so we can order chats by
// time_updated? Or is it possible to order by "unread_messages" annotation?
//$chat->time_updated = time();
} else {
示例6: crud_push_breadcrumb
/**
* Push breadcrumbs from the given crud object going up in the parent hirarchy
*
* @param ElggObject $last Ending object
* @param ElggObject $entity Current object
* @param CrudTemplate $crud Crud template object
*/
function crud_push_breadcrumb($last, $entity, $crud = NULL)
{
if (empty($crud)) {
$crud = crud_get_handler($entity->getSubtype());
}
if ($entity->parent_guid) {
$parent = get_entity($entity->parent_guid);
crud_push_breadcrumb($last, $parent);
} else {
$group = $entity->getContainerEntity();
elgg_push_breadcrumb($group->name, "{$crud->crud_type}/owner/{$entity->container_guid}");
}
$title = $entity->title;
if (empty($title)) {
$title = elgg_echo("{$crud->module}:{$crud->crud_type}");
}
if ($entity == $last) {
elgg_push_breadcrumb($title);
} else {
elgg_push_breadcrumb($title, "{$crud->crud_type}/view/{$entity->guid}");
}
}
示例7: getContainerEntity
/**
*
* {@inheritDoc}
*
* @return \APIApplication
*/
public function getContainerEntity()
{
return parent::getContainerEntity();
}