You are here

protected function BaseDataProvider::getFileData in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 src/DataProvider/BaseDataProvider.php \Drupal\gutenberg\DataProvider\BaseDataProvider::getFileData()

Get file managed data of the provided file.

Parameters

string $fid: File entity ID.

Return value

array The file data.

2 calls to BaseDataProvider::getFileData()
FileEntityDataProvider::getData in src/DataProvider/FileEntityDataProvider.php
Returns array data.
MediaEntityDataProvider::getData in src/DataProvider/MediaEntityDataProvider.php
Returns array data.

File

src/DataProvider/BaseDataProvider.php, line 62

Class

BaseDataProvider
Provides base abstraction for entity data providers.

Namespace

Drupal\gutenberg\DataProvider

Code

protected function getFileData(string $fid) {
  $query = $this->connection
    ->select('file_managed_data', 'data', []);
  $query
    ->condition('data.fid', $fid);
  $query
    ->fields('data', [
    'fid',
    'data',
  ]);
  $result = $query
    ->execute()
    ->fetchAll();
  return isset($result[0]->data) ? unserialize($result[0]->data) : [];
}