W3cubDocs

/Drupal 8

public function FileStorage::read

public FileStorage::read($name)

Implements Drupal\Core\Config\StorageInterface::read().

Throws

\Drupal\Core\Config\UnsupportedDataTypeConfigException

Overrides StorageInterface::read

File

core/lib/Drupal/Core/Config/FileStorage.php, line 89

Class

FileStorage
Defines the file storage.

Namespace

Drupal\Core\Config

Code

public function read($name) {
  if (!$this->exists($name)) {
    return FALSE;
  }
  $filepath = $this->getFilePath($name);
  $data = file_get_contents($filepath);
  try {
    $data = $this->decode($data);
  }
  catch (InvalidDataTypeException $e) {
    throw new UnsupportedDataTypeConfigException('Invalid data type in config ' . $name . ', found in file' . $filepath . ' : ' . $e->getMessage());
  }
  return $data;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!FileStorage.php/function/FileStorage::read/8.1.x