You are here

public function FilebrowserStorage::insertRecord in Filebrowser 3.x

Same name and namespace in other branches
  1. 8.2 src/Services/FilebrowserStorage.php \Drupal\filebrowser\Services\FilebrowserStorage::insertRecord()

File

src/Services/FilebrowserStorage.php, line 173

Class

FilebrowserStorage

Namespace

Drupal\filebrowser\Services

Code

public function insertRecord($record) {

  //fixme: root folder has no 'file_data'
  if (!isset($record['nid'])) {
    debug($record);
  }

  // todo: check file_data index is not set for an empty filebrowser node.
  if (empty($record['file_data'])) {
    $record['file_data'] = '';
  }
  return $this->connection
    ->insert('filebrowser_content')
    ->fields([
    'nid' => $record['nid'],
    'root' => $record['root'],
    'path' => $record['path'],
    'file_data' => serialize($record['file_data']),
  ])
    ->execute();
}