<?php
    $CMS_URL = 'https://cms.pixel-kraft.de';

    // $html[] = "<pre>". print_r($this, true) ."</pre>";
	$html = [];

    foreach ($this->team as $team) {
        $html[] = "<div class='department'>";
//        $link = JRoute::_("index.php?option=com_pixelcms_articles&view=pixelcms_articles&articleId=$team->id");
//        $html[] = "<a href='$link'><h2>$team->title</h2></a>";
        $html[] = "<h3>$team->title</h3>";
        $html[] = '<div class="department__workers">';
        foreach ($team->workers as $worker) {
            $html[] = "<div class='worker worker--col-4 worker--col-2-phone worker--col-3-tablet'>";
            $html[] = $this->displayWorker($worker);
            $html[] = "</div>";
        }
        $html[] = "</div>"; // department__workers
        $html[] = "</div>"; // department
    }

    if ($this->params->get('legacy_mode', '0') === '0') {
        $containerClass = $this->getContainerClass();
        $articleCount = count($this->news);
        array_unshift($html, "<div class=\"$containerClass\" data-count=\"$articleCount\">");
        array_push($html, '</div>');
    }
    if ($this->params->get('show_page_heading')) {
        array_unshift($html, "<div class=\"page-header\"><h2 itemprop=\"headline\">{$this->params->get('page_title')}</h2></div>");
    }



    echo implode("\n", $html);
