<?php
/**
* Landofcoder
*
* NOTICE OF LICENSE
*
* This source file is subject to the Landofcoder.com license that is
* available through the world-wide-web at this URL:
* https://landofcoder.com/license-agreement.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Landofcoder
* @package Lofmp_Blog
* @copyright Copyright (c) 2016 Landofcoder (https://landofcoder.com/)
* @license https://landofcoder.com/LICENSE-1.0.html
*/
namespace Lofmp\Blog\Model\Config\Source;
/**
* Used in recent post widget
*
*/
class CategoryPath extends CategoryTree
{
protected function _getOptions($itemId = 0)
{
$childs = $this->_getChilds();
$options = [];
if (!$itemId) {
$options[] = [
'label' => '',
'value' => 0,
];
}
if (isset($childs[$itemId])) {
foreach ($childs[$itemId] as $item) {
$data = [
'label' => $item->getName() .
($item->getIsActive() ? '' : ' ('.__('Disabled').')'),
'value' => ($item->getParentIds() ? $item->getPath().'/' : '') . $item->getId(),
];
if (isset($childs[$item->getId()])) {
$data['optgroup'] = $this->_getOptions($item->getId());
}
$options[] = $data;
}
}
return $options;
}
}
|