You are here

public function ImageCaptionStorage::deleteCaptionRevisions in Image Field Caption 8

Delete all captions revisions 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.

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

File

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

Class

ImageCaptionStorage
Storage controller class for image captions.

Namespace

Drupal\image_field_caption

Code

public function deleteCaptionRevisions($entity_type, $bundle, $field_name, $entity_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('language', $language, '=')
    ->execute();
  $this
    ->clearCache($field_name);

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