@@ -98,6 +98,10 @@ public function configureActions(Actions $actions): Actions
98
98
$ actions ->add (Crud::PAGE_INDEX , $ getFileLink );
99
99
$ actions ->add (Crud::PAGE_INDEX , $ getFileHtml );
100
100
101
+ if (count ($ this ->mediaCatalogRepository ->getAll ()) === 0 ) {
102
+ $ actions ->remove (Crud::PAGE_INDEX , Action::NEW );
103
+ }
104
+
101
105
return $ actions ;
102
106
}
103
107
@@ -111,12 +115,12 @@ public function getFileHtml(AdminContext $context)
111
115
public function configureFields (string $ pageName ): iterable
112
116
{
113
117
$ title = TextField::new ('title ' , 'Заголовок файла ' );
114
- $ name = TextField::new ('name ' , 'Заголовок файла ' );
115
118
$ file = VichFileField::new ('file ' , 'Файл ' );
116
119
$ catalog = AssociationField::new ('catalog ' , 'Каталог ' );
120
+ $ originalName = TextField::new ('originalName ' , 'Название файла ' );
117
121
118
122
if (in_array ($ pageName , [Crud::PAGE_INDEX , Crud::PAGE_DETAIL ], true )) {
119
- return [$ name , $ title , $ catalog ];
123
+ return [$ originalName , $ title , $ catalog ];
120
124
}
121
125
122
126
return [$ catalog , $ title , $ file ];
@@ -131,6 +135,7 @@ public function createEntity(string $entityFqcn): MediaFile
131
135
new MediaFileType (MediaFileType::IMAGE_TYPE ),
132
136
'' ,
133
137
new MediaFileStorage (MediaFileStorage::NFS_STORAGE ),
138
+ '' ,
134
139
);
135
140
}
136
141
}
0 commit comments