interface StorageInterface

Defines an interface for configuration storage controllers.

Classes implementing this interface allow reading and writing configuration data from and to the storage.

Hierarchy

Expanded class hierarchy of StorageInterface

All classes that implement StorageInterface

2 files declare their use of StorageInterface
config.admin.inc in drupal/core/modules/config/config.admin.inc
Admin page callbacks for the config module.
config.inc in drupal/core/includes/config.inc
This is the API for configuration storage.

File

drupal/core/lib/Drupal/Core/Config/StorageInterface.php, line 16
Definition of Drupal\Core\Config\StorageInterface.

Namespace

Drupal\Core\Config
View source
interface StorageInterface {

  /**
   * Returns whether a configuration object exists.
   *
   * @param string $name
   *   The name of a configuration object to test.
   *
   * @return bool
   *   TRUE if the configuration object exists, FALSE otherwise.
   */
  public function exists($name);

  /**
   * Reads configuration data from the storage.
   *
   * @param string $name
   *   The name of a configuration object to load.
   *
   * @return array|bool
   *   The configuration data stored for the configuration object name. If no
   *   configuration data exists for the given name, FALSE is returned.
   */
  public function read($name);

  /**
   * Writes configuration data to the storage.
   *
   * @param string $name
   *   The name of a configuration object to save.
   * @param array $data
   *   The configuration data to write.
   *
   * @return bool
   *   TRUE on success, FALSE in case of an error.
   */
  public function write($name, array $data);

  /**
   * Deletes a configuration object from the storage.
   *
   * @param string $name
   *   The name of a configuration object to delete.
   *
   * @return bool
   *   TRUE on success, FALSE otherwise.
   */
  public function delete($name);

  /**
   * Renames a configuration object in the storage.
   *
   * @param string $name
   *   The name of a configuration object to rename.
   * @param string $new_name
   *   The new name of a configuration object.
   *
   * @return bool
   *   TRUE on success, FALSE otherwise.
   */
  public function rename($name, $new_name);

  /**
   * Encodes configuration data into the storage-specific format.
   *
   * @param array $data
   *   The configuration data to encode.
   *
   * @return string
   *   The encoded configuration data.
   *
   * This is a publicly accessible static method to allow for alternative
   * usages in data conversion scripts and also tests.
   */
  public function encode($data);

  /**
   * Decodes configuration data from the storage-specific format.
   *
   * @param string $raw
   *   The raw configuration data string to decode.
   *
   * @return array
   *   The decoded configuration data as an associative array.
   *
   * This is a publicly accessible static method to allow for alternative
   * usages in data conversion scripts and also tests.
   */
  public function decode($raw);

  /**
   * Gets configuration object names starting with a given prefix.
   *
   * Given the following configuration objects:
   * - node.type.article
   * - node.type.page
   *
   * Passing the prefix 'node.type.' will return an array containing the above
   * names.
   *
   * @param string $prefix
   *   (optional) The prefix to search for. If omitted, all configuration object
   *   names that exist are returned.
   *
   * @return array
   *   An array containing matching configuration object names.
   */
  public function listAll($prefix = '');

}

Members

Namesort descending Modifiers Type Description Overrides
StorageInterface::decode public function Decodes configuration data from the storage-specific format. 4
StorageInterface::delete public function Deletes a configuration object from the storage. 4
StorageInterface::encode public function Encodes configuration data into the storage-specific format. 4
StorageInterface::exists public function Returns whether a configuration object exists. 4
StorageInterface::listAll public function Gets configuration object names starting with a given prefix. 4
StorageInterface::read public function Reads configuration data from the storage. 4
StorageInterface::rename public function Renames a configuration object in the storage. 4
StorageInterface::write public function Writes configuration data to the storage. 4