You are here

public function ConfigHelper::delete in Lightning Core 8.5

Same name and namespace in other branches
  1. 8 src/ConfigHelper.php \Drupal\lightning_core\ConfigHelper::delete()
  2. 8.2 src/ConfigHelper.php \Drupal\lightning_core\ConfigHelper::delete()
  3. 8.3 src/ConfigHelper.php \Drupal\lightning_core\ConfigHelper::delete()
  4. 8.4 src/ConfigHelper.php \Drupal\lightning_core\ConfigHelper::delete()

Overrides Drupal\Core\Config\FileStorage::delete().

Throws

\Drupal\Core\Config\StorageException

Overrides InstallStorage::delete

1 call to ConfigHelper::delete()
ConfigHelper::deleteAll in src/ConfigHelper.php
Overrides Drupal\Core\Config\FileStorage::deleteAll().

File

src/ConfigHelper.php, line 123

Class

ConfigHelper
A facade to assist with manipulating default config.

Namespace

Drupal\lightning_core

Code

public function delete($id) {
  foreach ($this
    ->getConfigPrefixes() as $entity_type => $prefix) {
    $prefix .= '.';
    if (mb_strpos($id, $prefix) === 0) {
      $entity = $this
        ->getEntity($entity_type, mb_substr($id, mb_strlen($prefix)));
      return $entity
        ->delete();
    }
  }
  return $this
    ->get($id)
    ->delete();
}