StorageReplaceDataWrapper::deleteAll

public StorageReplaceDataWrapper::deleteAll($prefix = '')

Deletes configuration objects whose names start with a given prefix.

Given the following configuration object names:

  • node.type.article
  • node.type.page

Passing the prefix 'node.type.' will delete the above configuration objects.

Parameters

string $prefix: (optional) The prefix to search for. If omitted, all configuration objects that exist will be deleted.

Return value

bool TRUE on success, FALSE otherwise.

Overrides StorageInterface::deleteAll

File

core/modules/config/src/StorageReplaceDataWrapper.php, line 150

Class

StorageReplaceDataWrapper
Wraps a configuration storage to allow replacing specific configuration data.

Namespace

Drupal\config

Code

public function deleteAll($prefix = '') {
  if ($prefix === '') {
    $this->replacementData[$this->collection] = [];
  }
  else {
    foreach (array_keys($this->replacementData[$this->collection]) as $name) {
      if (strpos($name, $prefix) === 0) {
        unset($this->replacementData[$this->collection][$name]);
      }
    }
  }
  return $this->storage->deleteAll($prefix);
}
doc_Drupal
2016-10-29 09:44:47
Comments
Leave a Comment

Please login to continue.