public function StringDatabaseStorage::save

Implements Drupal\locale\StringStorageInterface::save().

Overrides StringStorageInterface::save

File

drupal/core/modules/locale/lib/Drupal/locale/StringDatabaseStorage.php, line 121
Definition of Drupal\locale\StringDatabaseStorage.

Class

StringDatabaseStorage
Defines the locale string class.

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;
}