You are here

protected function XmlSitemapStorage::doSave in XML sitemap 8

Same name and namespace in other branches
  1. 2.x src/XmlSitemapStorage.php \Drupal\xmlsitemap\XmlSitemapStorage::doSave()

Performs storage-specific saving of the entity.

Parameters

int|string $id: The original entity ID.

\Drupal\Core\Entity\EntityInterface $entity: The entity to save.

Return value

bool|int If the record insert or update failed, returns FALSE. If it succeeded, returns SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Overrides ConfigEntityStorage::doSave

File

src/XmlSitemapStorage.php, line 115

Class

XmlSitemapStorage
XmlSitemap storage service class.

Namespace

Drupal\xmlsitemap

Code

protected function doSave($id, EntityInterface $entity) {

  // Store the xmlsitemap auxiliar data.
  $this->state
    ->set('xmlsitemap.' . $entity
    ->id(), [
    'chunks' => $entity
      ->getChunks(),
    'links' => $entity
      ->getLinks(),
    'max_filesize' => $entity
      ->getMaxFileSize(),
    'updated' => $entity
      ->getUpdated(),
  ]);
  $is_new = parent::doSave($id, $entity);
  return $is_new ? SAVED_NEW : SAVED_UPDATED;
}