You are here

protected function ContentExportController::_getObjectinFile in Content Export YAML 8

1 call to ContentExportController::_getObjectinFile()
ContentExportController::view in src/Controller/ContentExportController.php
Handles html requests.

File

src/Controller/ContentExportController.php, line 81

Class

ContentExportController
Class ContentExportController.

Namespace

Drupal\content_export_yaml\Controller

Code

protected function _getObjectinFile($file) {
  $file = DRUPAL_ROOT . $file;
  if (file_exists($file)) {
    $yaml_object = file_get_contents($file, FILE_USE_INCLUDE_PATH);
    $parsed = new Parser();
    $object = $parsed
      ->parse($yaml_object, SymfonyYaml::PARSE_OBJECT);
    if (is_object($object)) {
      return $object;
    }
  }
  return FALSE;
}