File: D:/HostingSpaces/SBogers10/topswtw.komma.pro/app/KommaApp/Shop/Modules/Breadcrumb/Breadcrumb.php
<?php
namespace KommaApp\Shop\Modules\Breadcrumb;
use KommaApp\Shop\Entities\AbstractEntity;
class Breadcrumb extends abstractEntity
{
public $title = '';
public $url = '';
public $active = false;
public $type = '';
public $parent = [];
public $child = [];
public function getChild()
{
if(empty($this->child)) return false;
return $this->child;
}
public function openString()
{
$output = '';
$output .= '<div';
if($this->active) $output .= ' class="active"';
$output .= ' itemscope itemtype="http://data-vocabulary.org/Breadcrumb">';
$output .= '<a href="/' . $this->url . '" itemprop="url">';
$output .= '<span itemprop="title">' . $this->title . '</span>';
$output .= '</a>';
// Separator
if( ! $this->active) $output .= '<span class="sep"></span>';
return $output;
}
public function closeString($numCrumbs = 1)
{
$output = '';
for($i=0;$i<$numCrumbs;$i++)
{
$output .= '</div>';
}
return $output;
}
public function render($position)
{
$output = \View::make('partials.breadcrumbCrumb')->with([
'active' => $this->active,
'title' => $this->title,
'url' => $this->url,
'position' => $position
])->render();
if( ! $this->active) $output .= '<span class="sep"></span>';
return $output;
}
}