You are here

public function ImageCaptionStorage::insertCaptionRevision in Image Field Caption 8

Insert a caption revision into 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'.

int $delta: The delta of the image field.

string $caption: The caption text.

string $caption_format: The text format of the caption.

File

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

Class

ImageCaptionStorage
Storage controller class for image captions.

Namespace

Drupal\image_field_caption

Code

public function insertCaptionRevision($entity_type, $bundle, $field_name, $entity_id, $revision_id, $language, $delta, $caption, $caption_format) {
  $query = $this->database
    ->insert($this->tableRevision);
  $query
    ->fields(array(
    'entity_type' => $entity_type,
    'bundle' => $bundle,
    'field_name' => $field_name,
    'entity_id' => $entity_id,
    'revision_id' => $revision_id,
    'language' => $language,
    'delta' => $delta,
    'caption' => $caption,
    'caption_format' => $caption_format,
  ))
    ->execute();
  $this
    ->clearCache($field_name);
}