public function ViewModesInventoryFactory::getLayoutsMapping in View Modes Inventory - Bootstrap Ready 8.2
Same name and namespace in other branches
- 8 src/ViewModesInventoryFactory.php \Drupal\vmi\ViewModesInventoryFactory::getLayoutsMapping()
Get get data from layouts.mapping.yml file.
Return value
array Data array for the default mapping layouts with view modes.
Throws
Exception
File
- src/
ViewModesInventoryFactory.php, line 91
Class
- ViewModesInventoryFactory
- View Modes Inventory Factory.
Namespace
Drupal\vmiCode
public function getLayoutsMapping() {
$module_path = $this->moduleHandler
->getModule('vmi')
->getPath();
$vmi_layout_filename = DRUPAL_ROOT . '/' . $module_path . '/src/assets/layouts.mapping.vmi.yml';
if (is_file($vmi_layout_filename)) {
$vmi_layout_list = (array) Yaml::parse(file_get_contents($vmi_layout_filename));
return $vmi_layout_list;
}
else {
$lookup_message = $this
->t('View modes inventory layouts list file does not exist!');
throw new \Exception($lookup_message);
}
}