You are here

public static function ViewModesInventoryFactory::getLayoutsMapping in View Modes Inventory - Bootstrap Ready 8

Same name and namespace in other branches
  1. 8.2 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

1 call to ViewModesInventoryFactory::getLayoutsMapping()
_vmi_form_entity_view_display_edit_form_submit in ./vmi.module
Apply mapped view modes inventory form entity view display edit form submit.

File

src/ViewModesInventoryFactory.php, line 47

Class

ViewModesInventoryFactory
View Modes Inventory Factory.

Namespace

Drupal\vmi

Code

public static function getLayoutsMapping() {
  $vmi_layout_filename = \Drupal::root() . '/' . drupal_get_path('module', 'vmi') . '/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 {
    throw new \Exception('View modes inventory layouts list file does not exist!');
  }
}