mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 09:14:58 +02:00
Add a new FieldtypeHasFiles interface and update FieldtypeFile and FieldtypeImage to implement it. This interface is intended to be implemented by any Fieldtype that works with files to provide a common interface among them.
This commit is contained in:
@@ -166,6 +166,42 @@ interface WireTrackable {
|
||||
*/
|
||||
interface FieldtypePageTitleCompatible { }
|
||||
|
||||
/**
|
||||
* Indicates Fieldtype manages files
|
||||
*
|
||||
*/
|
||||
interface FieldtypeHasFiles {
|
||||
/**
|
||||
* Whether or not given Page/Field has any files connected with it
|
||||
*
|
||||
* @param Page $page
|
||||
* @param Field $field
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function hasFiles(Page $page, Field $field);
|
||||
|
||||
/**
|
||||
* Get array of full path/file for all files managed by given page and field
|
||||
*
|
||||
* @param Page $page
|
||||
* @param Field $field
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
public function getFiles(Page $page, Field $field);
|
||||
|
||||
/**
|
||||
* Get path where files are (or would be) stored
|
||||
*
|
||||
* @param Page $page
|
||||
* @param Field $field
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function getFilesPath(Page $page, Field $field);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that an Inputfield provides tree selection capabilities
|
||||
|
Reference in New Issue
Block a user