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;
}