本文整理汇总了PHP中Breadcrumb::array_from_item_parents方法的典型用法代码示例。如果您正苦于以下问题:PHP Breadcrumb::array_from_item_parents方法的具体用法?PHP Breadcrumb::array_from_item_parents怎么用?PHP Breadcrumb::array_from_item_parents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Breadcrumb
的用法示例。
在下文中一共展示了Breadcrumb::array_from_item_parents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_breadcrumbs_for_item_test
public function build_breadcrumbs_for_item_test()
{
$album = test::random_album();
$item = test::random_photo($album);
$expected = array();
$expected[] = Breadcrumb::instance(item::root()->title, item::root()->url("show={$album->id}"))->set_first();
$expected[] = Breadcrumb::instance($album->title, $album->url("show={$item->id}"));
$expected[] = Breadcrumb::instance($item->title, $item->url())->set_last();
$this->assert_equal($expected, Breadcrumb::array_from_item_parents($item));
}
示例2: get_display_context
static function get_display_context($item)
{
$where = array(array("type", "!=", "album"));
$position = item::get_position($item, $where);
if ($position > 1) {
list($previous_item, $ignore, $next_item) = $item->parent()->viewable()->children(3, $position - 2, $where);
} else {
$previous_item = null;
list($next_item) = $item->parent()->viewable()->children(1, $position, $where);
}
return array("position" => $position, "previous_item" => $previous_item, "next_item" => $next_item, "sibling_count" => $item->parent()->viewable()->children_count($where), "siblings_callback" => array("Albums_Controller::get_siblings", array($item)), "parents" => $item->parents()->as_array(), "breadcrumbs" => Breadcrumb::array_from_item_parents($item));
}