private function generateCategoryData(NewsCategoryModel $category, Module $module)
    {
        $data = $category->row();

        $data['model'] = $category;
        $data['name'] = $category->getTitle();
        $data['class'] = $category->getCssClass();
        $data['href'] = '';
        $data['hrefWithParam'] = '';
        $data['targetPage'] = null;

        /** @var StringUtil $stringUtilAdapter */
        $stringUtilAdapter = $this->framework->getAdapter(StringUtil::class);
        $data['linkTitle'] = $stringUtilAdapter->specialchars($data['name']);

        /** @var PageModel $pageAdapter */
        $pageAdapter = $this->framework->getAdapter(PageModel::class);

        // Overwrite the category links with filter page set in module
        if ($module->news_categoryFilterPage && null !== ($targetPage = $pageAdapter->findPublishedById($module->news_categoryFilterPage))) {
            $data['href'] = $this->manager->generateUrl($category, $targetPage);
            $data['hrefWithParam'] = $data['href'];
            $data['targetPage'] = $targetPage;
        } elseif (null !== ($targetPage = $this->manager->getTargetPage($category))) {
            // Add the category target page and URLs
            $data['href'] = $targetPage->getFrontendUrl();
            $data['hrefWithParam'] = $this->manager->generateUrl($category, $targetPage);
            $data['targetPage'] = $targetPage;
        }

        // Register a function to generate category URL manually
        $data['generateUrl'] = function (PageModel $page, $absolute = false) use ($category) {
            return $this->manager->generateUrl($category, $page, $absolute);
        };

        // Add the image
        if (null !== ($image = $this->manager->getImage($category))) {
            /** @var Controller $controllerAdapter */
            $controllerAdapter = $this->framework->getAdapter(Controller::class);
            $data['image'] = new \stdClass();
            $controllerAdapter->addImageToTemplate($data['image'], ['singleSRC' => $image->path, 'size' => $module->news_categoryImgSize]);
        } else {
            $data['image'] = null;
        }

        return $data;
    }
private function generateCategoryData(NewsCategoryModel $category, Module $module)
    {
        $data = $category->row();

        $data['model'] = $category;
        $data['name'] = $category->getTitle();
        $data['class'] = $category->getCssClass();
        $data['href'] = '';
        $data['hrefWithParam'] = '';
        $data['targetPage'] = null;

        /** @var StringUtil $stringUtilAdapter */
        $stringUtilAdapter = $this->framework->getAdapter(StringUtil::class);
        $data['linkTitle'] = $stringUtilAdapter->specialchars($data['name']);

        /** @var PageModel $pageAdapter */
        $pageAdapter = $this->framework->getAdapter(PageModel::class);

        // Overwrite the category links with filter page set in module
        if ($module->news_categoryFilterPage && null !== ($targetPage = $pageAdapter->findPublishedById($module->news_categoryFilterPage))) {
            $data['href'] = $this->manager->generateUrl($category, $targetPage);
            $data['hrefWithParam'] = $data['href'];
            $data['targetPage'] = $targetPage;
        } elseif (null !== ($targetPage = $this->manager->getTargetPage($category))) {
            // Add the category target page and URLs
            $data['href'] = $targetPage->getFrontendUrl();
            $data['hrefWithParam'] = $this->manager->generateUrl($category, $targetPage);
            $data['targetPage'] = $targetPage;
        }

        // Register a function to generate category URL manually
        $data['generateUrl'] = function (PageModel $page, $absolute = false) use ($category) {
            return $this->manager->generateUrl($category, $page, $absolute);
        };

        // Add the image
        if (null !== ($image = $this->manager->getImage($category))) {
            /** @var Controller $controllerAdapter */
            $controllerAdapter = $this->framework->getAdapter(Controller::class);
            $data['image'] = new \stdClass();
            $controllerAdapter->addImageToTemplate($data['image'], ['singleSRC' => $image->path, 'size' => $module->news_categoryImgSize]);
        } else {
            $data['image'] = null;
        }

        return $data;
    }
private function generateCategoryData ( NewsCategoryModel $ category , Module $ module ) { $ data = $ category -> row ( ) ; $ data [ 'model' ] = $ category ; $ data [ 'name' ] = $ category -> getTitle ( ) ; $ data [ 'class' ] = $ category -> getCssClass ( ) ; $ data [ 'href' ] = '' ; $ data [ 'hrefWithParam' ] = '' ; $ data [ 'targetPage' ] = null ; /** @var StringUtil $stringUtilAdapter */ $ stringUtilAdapter = $ this -> framework -> getAdapter ( StringUtil :: class ) ; $ data [ 'linkTitle' ] = $ stringUtilAdapter -> specialchars ( $ data [ 'name' ] ) ; /** @var PageModel $pageAdapter */ $ pageAdapter = $ this -> framework -> getAdapter ( PageModel :: class ) ; // Overwrite the category links with filter page set in module if ( $ module -> news_categoryFilterPage && null !== ( $ targetPage = $ pageAdapter -> findPublishedById ( $ module -> news_categoryFilterPage ) ) ) { $ data [ 'href' ] = $ this -> manager -> generateUrl ( $ category , $ targetPage ) ; $ data [ 'hrefWithParam' ] = $ data [ 'href' ] ; $ data [ 'targetPage' ] = $ targetPage ; } elseif ( null !== ( $ targetPage = $ this -> manager -> getTargetPage ( $ category ) ) ) { // Add the category target page and URLs $ data [ 'href' ] = $ targetPage -> getFrontendUrl ( ) ; $ data [ 'hrefWithParam' ] = $ this -> manager -> generateUrl ( $ category , $ targetPage ) ; $ data [ 'targetPage' ] = $ targetPage ; } // Register a function to generate category URL manually $ data [ 'generateUrl' ] = function ( PageModel $ page , $ absolute = false ) use ( $ category ) { return $ this -> manager -> generateUrl ( $ category , $ page , $ absolute ) ; } ; // Add the image if ( null !== ( $ image = $ this -> manager -> getImage ( $ category ) ) ) { /** @var Controller $controllerAdapter */ $ controllerAdapter = $ this -> framework -> getAdapter ( Controller :: class ) ; $ data [ 'image' ] = new \ stdClass ( ) ; $ controllerAdapter -> addImageToTemplate ( $ data [ 'image' ] , [ 'singleSRC' => $ image -> path , 'size' => $ module -> news_categoryImgSize ] ) ; } else { $ data [ 'image' ] = null ; } return $ data ; }
Generate the category data.

@param NewsCategoryModel $category
@param Module            $module

@return array
Generate the category data .