protected function generateItem($url, $link, $title, $cssClass, $isActive, $subitems = '', NewsCategoryModel $category = null)
    {
        $data = [];

        // Set the data from category
        if (null !== $category) {
            $data = $category->row();
        }

        $data['isActive'] = $isActive;
        $data['subitems'] = $subitems;
        $data['class'] = $cssClass;
        $data['title'] = StringUtil::specialchars($title);
        $data['linkTitle'] = StringUtil::specialchars($title);
        $data['link'] = $link;
        $data['href'] = ampersand($url);
        $data['quantity'] = 0;

        // Add the "active" class
        if ($isActive) {
            $data['class'] = \trim($data['class'].' active');
        }

        // Add the "submenu" class
        if ($subitems) {
            $data['class'] = \trim($data['class'].' submenu');
        }

        // Add the news quantity
        if ($this->news_showQuantity) {
            if (null === $category) {
                $data['quantity'] = NewsCategoryModel::getUsage($this->news_archives);
            } else {
                $data['quantity'] = NewsCategoryModel::getUsage($this->news_archives, $category->id, (bool) $this->news_includeSubcategories);
            }
        }

        // Add the image
        if (null !== $category && null !== ($image = $this->manager->getImage($category))) {
            $data['image'] = new \stdClass();
            Controller::addImageToTemplate($data['image'], [
                'singleSRC' => $image->path,
                'size' => $this->news_categoryImgSize,
                'alt' => $title,
                'imageTitle' => $title,
            ]);
        } else {
            $data['image'] = null;
        }

        return $data;
    }
protected function generateItem($url, $link, $title, $cssClass, $isActive, $subitems = '', NewsCategoryModel $category = null)
    {
        $data = [];

        // Set the data from category
        if (null !== $category) {
            $data = $category->row();
        }

        $data['isActive'] = $isActive;
        $data['subitems'] = $subitems;
        $data['class'] = $cssClass;
        $data['title'] = StringUtil::specialchars($title);
        $data['linkTitle'] = StringUtil::specialchars($title);
        $data['link'] = $link;
        $data['href'] = ampersand($url);
        $data['quantity'] = 0;

        // Add the "active" class
        if ($isActive) {
            $data['class'] = \trim($data['class'].' active');
        }

        // Add the "submenu" class
        if ($subitems) {
            $data['class'] = \trim($data['class'].' submenu');
        }

        // Add the news quantity
        if ($this->news_showQuantity) {
            if (null === $category) {
                $data['quantity'] = NewsCategoryModel::getUsage($this->news_archives);
            } else {
                $data['quantity'] = NewsCategoryModel::getUsage($this->news_archives, $category->id, (bool) $this->news_includeSubcategories);
            }
        }

        // Add the image
        if (null !== $category && null !== ($image = $this->manager->getImage($category))) {
            $data['image'] = new \stdClass();
            Controller::addImageToTemplate($data['image'], [
                'singleSRC' => $image->path,
                'size' => $this->news_categoryImgSize,
                'alt' => $title,
                'imageTitle' => $title,
            ]);
        } else {
            $data['image'] = null;
        }

        return $data;
    }
protected function generateItem ( $ url , $ link , $ title , $ cssClass , $ isActive , $ subitems = '' , NewsCategoryModel $ category = null ) { $ data = [ ] ; // Set the data from category if ( null !== $ category ) { $ data = $ category -> row ( ) ; } $ data [ 'isActive' ] = $ isActive ; $ data [ 'subitems' ] = $ subitems ; $ data [ 'class' ] = $ cssClass ; $ data [ 'title' ] = StringUtil :: specialchars ( $ title ) ; $ data [ 'linkTitle' ] = StringUtil :: specialchars ( $ title ) ; $ data [ 'link' ] = $ link ; $ data [ 'href' ] = ampersand ( $ url ) ; $ data [ 'quantity' ] = 0 ; // Add the "active" class if ( $ isActive ) { $ data [ 'class' ] = \ trim ( $ data [ 'class' ] . ' active' ) ; } // Add the "submenu" class if ( $ subitems ) { $ data [ 'class' ] = \ trim ( $ data [ 'class' ] . ' submenu' ) ; } // Add the news quantity if ( $ this -> news_showQuantity ) { if ( null === $ category ) { $ data [ 'quantity' ] = NewsCategoryModel :: getUsage ( $ this -> news_archives ) ; } else { $ data [ 'quantity' ] = NewsCategoryModel :: getUsage ( $ this -> news_archives , $ category -> id , ( bool ) $ this -> news_includeSubcategories ) ; } } // Add the image if ( null !== $ category && null !== ( $ image = $ this -> manager -> getImage ( $ category ) ) ) { $ data [ 'image' ] = new \ stdClass ( ) ; Controller :: addImageToTemplate ( $ data [ 'image' ] , [ 'singleSRC' => $ image -> path , 'size' => $ this -> news_categoryImgSize , 'alt' => $ title , 'imageTitle' => $ title , ] ) ; } else { $ data [ 'image' ] = null ; } return $ data ; }
Generate the item.

@param string                 $url
@param string                 $link
@param string                 $title
@param string                 $cssClass
@param bool                   $isActive
@param string                 $subitems
@param NewsCategoryModel|null $category

@return array
Generate the item .