Contao\FrontendTemplate::sections PHP Method

sections() public method

Return the custom layout sections
public sections ( string $key = null, string $template = null )
$key string An optional section name
$template string An optional template name
    public function sections($key = null, $template = null)
    {
        if (!array_filter($this->sections)) {
            return;
        }
        // The key does not match
        if ($key && !isset($this->positions[$key])) {
            return;
        }
        $matches = array();
        foreach ($this->positions[$key] as $id => $section) {
            if (isset($this->sections[$id])) {
                $section['content'] = $this->sections[$id];
                $matches[$id] = $section;
            }
        }
        $this->matches = $matches;
        if ($template === null) {
            $template = 'block_sections';
        }
        include $this->getTemplate($template, $this->strFormat);
    }