You are here

public function StringBase::save in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::save()
  2. 10 core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::save()

Saves string object to storage.

Return value

$this

Throws

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

Overrides StringInterface::save

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

File

core/modules/locale/src/StringBase.php, line 183

Class

StringBase
Defines the locale string base class.

Namespace

Drupal\locale

Code

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