public function AFile::getData in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Gets a data for response format file representation.
1 method overrides AFile::getData()
- FileUploadedQuick::getData in src/
Flmngr/ FileUploaderServer/ lib/ file/ FileUploadedQuick.php - Gets a data for response format file representation.
File
- src/
Flmngr/ FileUploaderServer/ lib/ file/ AFile.php, line 36
Class
- AFile
- Abstract file item both for just uploaded and fully commited files. Contains some handy method for accessing files info programmatically.
Namespace
Drupal\n1ed\Flmngr\FileUploaderServer\lib\fileCode
public function getData() {
$data = new FileData();
$data->isCommited = $this
->isCommited();
$data->name = $this
->getName();
$data->dir = $this
->getDir();
$data->bytes = $this
->getSize();
$errors = $this
->getErrors();
$data->errors = [];
for ($i = 0; $i < count($errors); $i++) {
$data->errors[] = (array) $errors[$i];
}
$data->isImage = $this
->isImage();
$data->sizes = [];
if ($data->isImage) {
$data->width = $this
->getImageWidth();
$data->height = $this
->getImageHeight();
if ($data->isCommited) {
// mainFile is property of FileCommited.
if ($this->mainFile === NULL) {
$modifications = $this
->getModifications();
for ($i = 0; $i < count($modifications); $i++) {
$data->sizes[$modifications[$i]
->getModificationName()] = $modifications[$i]
->getData();
}
}
}
}
return $data;
}