You are here

public function StringBase::delete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::delete()

Deletes string object from storage.

Return value

$this

Throws

\Drupal\locale\StringStorageException In case of failures, an exception is thrown.

Overrides StringInterface::delete

1 call to StringBase::delete()
TranslationString::delete in core/modules/locale/src/TranslationString.php
Deletes string object from storage.
1 method overrides StringBase::delete()
TranslationString::delete in core/modules/locale/src/TranslationString.php
Deletes string object from storage.

File

core/modules/locale/src/StringBase.php, line 199
Contains \Drupal\locale\StringBase.

Class

StringBase
Defines the locale string base class.

Namespace

Drupal\locale

Code

public function delete() {
  if (!$this
    ->isNew()) {
    if ($storage = $this
      ->getStorage()) {
      $storage
        ->delete($this);
    }
    else {
      throw new StringStorageException('The string cannot be deleted because its not bound to a storage: ' . $this
        ->getString());
    }
  }
  return $this;
}