Get defined grid layouts.
array Array of defined grid layouts.
Overrides GridLayoutDiscoveryInterface::getGridLayouts
public function getGridLayouts() {
$cid = 'paragraphs_collection_grid_layouts';
if ($this->gridLayoutsCollection) {
return $this->gridLayoutsCollection;
}
else {
if ($cached = $this->cache
->get($cid)) {
$this->gridLayoutsCollection = $cached->data;
}
else {
$yaml_discovery = $this
->getYamlDiscovery();
$this->gridLayoutsCollection = [];
foreach ($yaml_discovery
->findAll() as $provider => $layouts) {
foreach ($layouts as $layout => $definition) {
if (empty($definition['title'])) {
throw new InvalidGridLayoutException('The "title" of "' . $layout . '" must be non-empty.');
}
$definition['title'] = $this
->t($definition['title']);
if (!empty($definition['description'])) {
$definition['description'] = $this
->t($definition['description']);
}
$definition['provider'] = $provider;
$this->gridLayoutsCollection[$layout] = $definition;
}
}
$this->cache
->set($cid, $this->gridLayoutsCollection);
}
}
return $this->gridLayoutsCollection;
}