You are here

public function ImageCaptionStorage::deleteCaptionRevision in Image Field Caption 8

Delete a caption revision from the database for the specified arguments.

Parameters

string $entity_type: The entity type, like 'node' or 'comment'.

string $bundle: The bundle, like 'article' or 'news'.

string $field_name: The field name of the image field, like 'field_image' or 'field_article_image'.

int $entity_id: The entity id.

int $revision_id: The revision id.

string $language: The language key, like 'en' or 'fr'.

File

src/ImageCaptionStorage.php, line 303
Contains \Drupal\image_field_caption\ImageCaptionStorage.

Class

ImageCaptionStorage
Storage controller class for image captions.

Namespace

Drupal\image_field_caption

Code

public function deleteCaptionRevision($entity_type, $bundle, $field_name, $entity_id, $revision_id, $language) {
  $query = $this->database
    ->delete($this->tableRevision);
  $query
    ->condition('entity_type', $entity_type, '=')
    ->condition('bundle', $bundle, '=')
    ->condition('field_name', $field_name, '=')
    ->condition('entity_id', $entity_id, '=')
    ->condition('revision_id', $revision_id, '=')
    ->condition('language', $language, '=')
    ->execute();
  $this
    ->clearCache($field_name);

  // @todo Try to return the count of the affected rows.
}