Beispiel #1
0
 /**
  * Creates the a new Breadcrumb.
  *
  * @param array $links      An array of breadcrumbs links
  * @param array $attributes Attributes to apply the breadcrumbs wrapper
  *
  * @return string A breadcrumbs-styled unordered list
  */
 public static function create($links, $attributes = array())
 {
     // If no links given, cancel
     if (empty($links)) {
         return false;
     }
     // Render each link
     $listItems = array();
     foreach ($links as $label => $url) {
         $listItems[] = (is_string($label) or is_array($url)) ? static::renderItem(Helpers::getContainer('html')->link($url, $label)) : static::renderItem($url, true);
     }
     return Lists::ul($listItems, $attributes)->addClass('breadcrumb');
 }
Beispiel #2
0
 public function testCanSetCustomElementsOnChildren()
 {
     $list = Lists::ul(array('a' => 'foo', 'bar'));
     $this->assertEquals('<ul><a>foo</a><li>bar</li></ul>', $list->render());
 }