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