Aimeos\Shop\Base\Page::getSections PHP Method

getSections() public method

Returns the body and header sections created by the clients configured for the given page name.
public getSections ( string $pageName ) : array
$pageName string Name of the configured page
return array Associative list with body and header output separated by client name
    public function getSections($pageName)
    {
        $context = $this->context->get();
        $langid = $context->getLocale()->getLanguageId();
        $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates');
        $view = $this->view->create($context, $tmplPaths, $langid);
        $context->setView($view);
        $pagesConfig = $this->config->get('shop.page', array());
        $result = array('aibody' => array(), 'aiheader' => array());
        if (isset($pagesConfig[$pageName])) {
            foreach ((array) $pagesConfig[$pageName] as $clientName) {
                $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
                $client->setView(clone $view);
                $client->process();
                $result['aibody'][$clientName] = $client->getBody();
                $result['aiheader'][$clientName] = $client->getHeader();
            }
        }
        return $result;
    }

Usage Example

Esempio n. 1
0
 /**
  * Returns the body and header output for the given page name
  *
  * @param string $pageName Page name as defined in the Settings.yaml file
  */
 protected function getSections($pageName)
 {
     return $this->page->getSections($this->request, $pageName);
 }