<? if ( is_array( $this -> categories ) ):?>
  <ol>
    <? foreach ( $this -> categories as $category ):?>
      <li id="list_<?= $category[ 'id' ];?>" class="list_<?= $category[ 'id' ];?>" category="<?= $category[ 'id' ];?>">
        <div class="context_0 content content_menu">
          <button type="button" class="disclose layout-tree-toggle" aria-expanded="false" title="Rozwin / zwin">
            <i class="fa fa-caret-right"></i>
          </button>
          <? if ( !$category[ 'status' ] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?>
          <input type="checkbox" class="g-checkbox" name="<?= $this -> name ? $this -> name : 'categories[]';?>" value="<?= $category[ 'id' ];?>" <? if ( is_array( $this -> product_categories ) and in_array( $category[ 'id' ], $this -> product_categories ) ):?>checked="checked"<? endif;?> />
          <b><?= $category[ 'languages' ][ $this -> dlang ][ 'title' ];?></b>
        </div>
        <?=
        \Tpl::view( 'shop-product/subcategories-list', [
          'categories'         => ( new \Domain\Category\CategoryRepository( $GLOBALS['mdb'] ) )->subcategories( $category[ 'id' ] ),
            'product_categories' => $this -> product_categories,
            'dlang'              => $this -> dlang,
            'name'               => $this -> name
        ] );
        ?>
      </li>
    <? endforeach;?>
  </ol>
<? endif;?>