getView() public method

Get the view used to display this river item
public getView ( ) : string
return string
示例#1
0
/**
 * Renders a human-readable representation of a river item
 *
 * @param ElggRiverItem $item A river item object
 * @param array         $vars An array of variables for the view
 *
 * @return string returns empty string if could not be rendered
 */
function elgg_view_river_item($item, array $vars = array())
{
    if (!$item instanceof ElggRiverItem) {
        return '';
    }
    // checking default viewtype since some viewtypes do not have unique views per item (rss)
    $view = $item->getView();
    if (!$view || !elgg_view_exists($view, 'default')) {
        return '';
    }
    $subject = $item->getSubjectEntity();
    $object = $item->getObjectEntity();
    if (!$subject || !$object) {
        // subject is disabled or subject/object deleted
        return '';
    }
    // @todo this needs to be cleaned up
    // Don't hide objects in closed groups that a user can see.
    // see https://github.com/elgg/elgg/issues/4789
    //	else {
    //		// hide based on object's container
    //		$visibility = Elgg_GroupItemVisibility::factory($object->container_guid);
    //		if ($visibility->shouldHideItems) {
    //			return '';
    //		}
    //	}
    $vars['item'] = $item;
    return elgg_view('river/item', $vars);
}
示例#2
0
文件: views.php 项目: rasul/Elgg
/**
 * Renders a human-readable representation of a river item
 *
 * @param ElggRiverItem $item A river item object
 * @param array         $vars An array of variables for the view
 *
 * @return string|false Depending on success
 */
function elgg_view_river_item($item, array $vars = array())
{
    // checking default viewtype since some viewtypes do not have unique views per item (rss)
    if (!$item || !$item->getView() || !elgg_view_exists($item->getView(), 'default')) {
        return '';
    }
    $subject = $item->getSubjectEntity();
    $object = $item->getObjectEntity();
    if (!$subject || !$object) {
        // subject is disabled or subject/object deleted
        return '';
    }
    $vars['item'] = $item;
    return elgg_view('river/item', $vars);
}