You are here

public function ImageCaptionStorage::deleteCaption in Image Field Caption 8

Delete a caption 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.

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

File

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

Class

ImageCaptionStorage
Storage controller class for image captions.

Namespace

Drupal\image_field_caption

Code

public function deleteCaption($entity_type, $bundle, $field_name, $entity_id, $language) {
  $query = $this->database
    ->delete($this->tableData);
  $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.
}