1
0
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:
Ryan Cramer
2021-07-08 11:36:19 -04:00
parent 88ae66e186
commit 498010ad8f
3 changed files with 126 additions and 2 deletions

View File

@@ -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