StringDatabaseStorage::save

public StringDatabaseStorage::save($string)

Save string object to storage.

Parameters

\Drupal\locale\StringInterface $string: The string object.

Return value

\Drupal\locale\StringStorageInterface The called object.

Throws

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

Overrides StringStorageInterface::save

File

core/modules/locale/src/StringDatabaseStorage.php, line 114

Class

StringDatabaseStorage
Defines a class to store localized strings in the database.

Namespace

Drupal\locale

Code

public function save($string) {
  if ($string->isNew()) {
    $result = $this->dbStringInsert($string);
    if ($string->isSource() && $result) {
      // Only for source strings, we set the locale identifier.
      $string->setId($result);
    }
    $string->setStorage($this);
  }
  else {
    $this->dbStringUpdate($string);
  }
  // Update locations if they come with the string.
  $this->updateLocation($string);
  return $this;
}
doc_Drupal
2016-10-29 09:45:09
Comments
Leave a Comment

Please login to continue.