mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
ENHANCEMENT: Use File->Title to set default Title
Use `$uploadedFile->Title` when setting the records default Title as it gives a much nicer output than `basename($uploadedFile->getFilename())`
This commit is contained in:
parent
c25dcbfdea
commit
20c9864cca
@ -156,15 +156,13 @@ class GridFieldBulkUpload_Request extends RequestHandler
|
|||||||
$title = $record->getTitle();
|
$title = $record->getTitle();
|
||||||
if ( !$title || $title === $record->ID )
|
if ( !$title || $title === $record->ID )
|
||||||
{
|
{
|
||||||
$title = basename($uploadedFile->getFilename());
|
|
||||||
|
|
||||||
if ( $record->hasDatabaseField('Title') )
|
if ( $record->hasDatabaseField('Title') )
|
||||||
{
|
{
|
||||||
$record->Title = $title;
|
$record->Title = $uploadedFile->Title;
|
||||||
$record->write();
|
$record->write();
|
||||||
}
|
}
|
||||||
else if ($record->hasDatabaseField('Name')){
|
else if ($record->hasDatabaseField('Name')){
|
||||||
$record->Name = $title;
|
$record->Name = $uploadedFile->Title;
|
||||||
$record->write();
|
$record->write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user