You are here

class StorageEntityApi in Configuration Management 7.2

Hierarchy

Expanded class hierarchy of StorageEntityApi

File

lib/Drupal/configuration/Storage/StorageEntityApi.php, line 12
Definition of Drupal\configuration\Storage\StorageEntityApi.

Namespace

Drupal\configuration\Storage
View source
class StorageEntityApi extends StoragePHP {

  // The class that storages the data of the configuration
  protected $entity_type;
  public function __construct($entity_type) {
    parent::__construct();
    $this->entity_type = $entity_type;
  }

  /**
   * Saves the configuration object into the DataStore.
   */
  public function getDataToSave() {
    $filename = $this->filename;
    $export = '$api = ' . $this
      ->export($this->api_version) . ";\n\n";
    $export .= '$data = entity_import(\'' . $this->entity_type . "', '" . addcslashes(entity_export($this->entity_type, $this->data, '  '), '\\\'') . "');\n\n";
    $export .= '$dependencies = ' . $this
      ->export($this->dependencies) . ";\n\n";
    $export .= '$optional = ' . $this
      ->export($this->optional_configurations) . ";\n\n";
    $export .= '$modules = ' . $this
      ->export($this->required_modules) . ";";
    $file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n";
    $this->hash = sha1($file_contents);
    return $file_contents;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Storage::$api_version protected property
Storage::$data protected property
Storage::$dependencies protected property
Storage::$filename protected property
Storage::$hash protected property
Storage::$keys_to_export protected property
Storage::$loaded protected property
Storage::$optional_configurations protected property
Storage::$required_modules protected property
Storage::checkDirectory public static function Returns TRUE if the path is a directory or we can create one in that path.
Storage::checkFilePermissions public static function Returns TRUE if the current user has write permissions for a configuration file in the config:// directory.
Storage::checkForChanges public function
Storage::configFileExists public static function Returns TRUE if the file for a configuration exists in the config:// directory.
Storage::getApiVersion public function
Storage::getData public function
Storage::getDependencies public function
Storage::getFileExtension public static function
Storage::getFileName public function
Storage::getHash public function
Storage::getModules public function
Storage::getOptionalConfigurations public function
Storage::reLoad public function
Storage::reset public function
Storage::setApiVersion public function
Storage::setData public function
Storage::setDependencies public function
Storage::setFileName public function
Storage::setKeysToExport public function Set an array of keys names to export. If the array is empty, all the keys of the configuration will be exported.
Storage::setModules public function
Storage::setOptionalConfigurations public function
Storage::withData public function
StorageEntityApi::$entity_type protected property
StorageEntityApi::getDataToSave public function Saves the configuration object into the DataStore. Overrides StoragePhp::getDataToSave
StorageEntityApi::__construct public function Overrides Storage::__construct
StoragePhp::$file_extension public static property Overrides Storage::$file_extension
StoragePhp::delete public function
StoragePhp::export public function Adapted from CTools ctools_var_export(). Overrides Storage::export
StoragePhp::import public function Overrides Storage::import
StoragePhp::load public function Loads the configuration object from the DataStore. Overrides Storage::load
StoragePhp::save public function Saves the configuration object into the DataStore. Overrides Storage::save