projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pull merge.
[yaffs-website]
/
web
/
core
/
modules
/
file
/
src
/
Entity
/
File.php
diff --git
a/web/core/modules/file/src/Entity/File.php
b/web/core/modules/file/src/Entity/File.php
index a68b9bae9bcf5ef87098a9a592aae15ddea7302c..33f6d744cc2b36e980a6ea4588aad9d74c403aaa 100644
(file)
--- a/
web/core/modules/file/src/Entity/File.php
+++ b/
web/core/modules/file/src/Entity/File.php
@@
-18,6
+18,13
@@
use Drupal\user\UserInterface;
* @ContentEntityType(
* id = "file",
* label = @Translation("File"),
* @ContentEntityType(
* id = "file",
* label = @Translation("File"),
+ * label_collection = @Translation("Files"),
+ * label_singular = @Translation("file"),
+ * label_plural = @Translation("files"),
+ * label_count = @PluralTranslation(
+ * singular = "@count file",
+ * plural = "@count files",
+ * ),
* handlers = {
* "storage" = "Drupal\file\FileStorage",
* "storage_schema" = "Drupal\file\FileStorageSchema",
* handlers = {
* "storage" = "Drupal\file\FileStorage",
* "storage_schema" = "Drupal\file\FileStorageSchema",
@@
-190,7
+197,10
@@
class File extends ContentEntityBase implements FileInterface {
// The file itself might not exist or be available right now.
$uri = $this->getFileUri();
// The file itself might not exist or be available right now.
$uri = $this->getFileUri();
- if ($size = @filesize($uri)) {
+ $size = @filesize($uri);
+
+ // Set size unless there was an error.
+ if ($size !== FALSE) {
$this->setSize($size);
}
}
$this->setSize($size);
}
}
@@
-240,7
+250,7
@@
class File extends ContentEntityBase implements FileInterface {
->setLabel(t('Filename'))
->setDescription(t('Name of the file with no path components.'));
->setLabel(t('Filename'))
->setDescription(t('Name of the file with no path components.'));
- $fields['uri'] = BaseFieldDefinition::create('uri')
+ $fields['uri'] = BaseFieldDefinition::create('
file_
uri')
->setLabel(t('URI'))
->setDescription(t('The URI to access the file (either local or remote).'))
->setSetting('max_length', 255)
->setLabel(t('URI'))
->setDescription(t('The URI to access the file (either local or remote).'))
->setSetting('max_length', 255)