You are here

public function ImageCaptionStorage::list in Image Field Caption 8

File

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

Class

ImageCaptionStorage
Storage controller class for image captions.

Namespace

Drupal\image_field_caption

Code

public function list($key = 'entity_type') {
  $list =& drupal_static(__FUNCTION__);
  if (!isset($list[$key])) {

    // Query.
    $query = $this->database
      ->select($this->tableData, 'ifc');
    $result = $query
      ->fields('ifc', array(
      $key,
    ))
      ->distinct()
      ->execute()
      ->fetchAll();
    $list[$key] = [];
    foreach ($result as $row) {
      $list[$key][] = $row->{$key};
    }
  }
  return $list[$key];
}