-
-
Save mooror/33b3dee86a01524d9fd530f8945818d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CustomUploadField extends UploadField { | |
/** | |
* FieldList $fields or string $name (of a method on File to provide a fields) for the EditForm | |
* @example 'getCMSFields' | |
* | |
* @var FieldList|string | |
*/ | |
private static $fileOwnerId =0; | |
/** | |
* FieldList $fields or string $name (of a method on File to provide a fields) for the EditForm | |
* @example 'getCMSFields' | |
* | |
* @var FieldList|string | |
*/ | |
private static $itemTitle = 'Defualt'; | |
/** | |
* FieldList $fields or string $name (of a method on File to provide a fields) for the EditForm | |
* @example 'getCMSFields' | |
* | |
* @var FieldList|string | |
*/ | |
private static $itemVersion = '0.0.1'; | |
// public function setFileOwnerId($fileOwnerId){ | |
// $this->$fileOwnerId = $fileOwnerId; | |
// Debug::show($this->$fileOwnerId); | |
// Debug::show($fileOwnerId); | |
// } | |
// public function setItemTitle($itemTitle){ | |
// $this->$itemTitle = $itemTitle; | |
// } | |
// public function setItemVersion($itemVersion){ | |
// $this->$itemVersion = $itemVersion; | |
// } | |
// public function setNameGeneratorInfo($fileOwnerId,$itemTitle,$itemVersion){ | |
// $this->$fileOwnerId = $fileOwnerId; | |
// $this->$itemTitle = $itemTitle; | |
// $this->$itemVersion = $itemVersion; | |
// return $this; | |
// } | |
public function getGeneratedFileName(){ | |
$userId = $this->$fileOwnerId; | |
$itemTitle = $this->$itemTitle; | |
$itemVersion = $this->$itemVersion; | |
return hash("md5", $userId.$itemTitle.$itemVersion); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment