HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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;
    }

}