RainLab\Pages\Classes\Page::listLayoutPlaceholders PHP Method

listLayoutPlaceholders() public method

Returns information about placeholders defined in the page layout.
public listLayoutPlaceholders ( ) : array
return array Returns an associative array of the placeholder name and codes.
    public function listLayoutPlaceholders()
    {
        if (!($layout = $this->getLayoutObject())) {
            return [];
        }
        $result = [];
        $bodyNode = $layout->getTwigNodeTree()->getNode('body')->getNode(0);
        $nodes = $this->flattenTwigNode($bodyNode);
        foreach ($nodes as $node) {
            if (!$node instanceof \Cms\Twig\PlaceholderNode) {
                continue;
            }
            $title = $node->hasAttribute('title') ? trim($node->getAttribute('title')) : null;
            if (!strlen($title)) {
                $title = $node->getAttribute('name');
            }
            $type = $node->hasAttribute('type') ? trim($node->getAttribute('type')) : null;
            $ignore = $node->hasAttribute('ignore') ? trim($node->getAttribute('ignore')) : false;
            $placeholderInfo = ['title' => $title, 'type' => $type ?: 'html', 'ignore' => $ignore];
            $result[$node->getAttribute('name')] = $placeholderInfo;
        }
        return $result;
    }