function StringDatabaseStorage::delete
Same name in other branches
- 9 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::delete()
- 8.9.x core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::delete()
- 10 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::delete()
File
-
core/
modules/ locale/ src/ StringDatabaseStorage.php, line 188
Class
- StringDatabaseStorage
- Defines a class to store localized strings in the database.
Namespace
Drupal\localeCode
public function delete($string) {
if ($keys = $this->dbStringKeys($string)) {
$this->dbDelete('locales_target', $keys)
->execute();
if ($string->isSource()) {
$this->dbDelete('locales_source', $keys)
->execute();
$this->dbDelete('locales_location', $keys)
->execute();
$string->setId(NULL);
}
}
else {
throw new StringStorageException('The string cannot be deleted because it lacks some key fields: ' . $string->getString());
}
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.