Add mimetype to creators

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-11-26 13:07:15 +01:00
parent 9a2694fcb0
commit 329e8c2604
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
3 changed files with 14 additions and 5 deletions

View File

@ -102,12 +102,9 @@ class Capabilities implements ICapability {
'id' => $id,
'name' => $creator->getName(),
'extension' => $creator->getExtension(),
'templates' => false
'templates' => $creator instanceof ACreateFromTemplate,
'mimetype' => $creator->getMimetype()
];
if ($creator instanceof ACreateFromTemplate) {
$capabilities['creators'][$id]['templates'] = true;
}
}
}
return $capabilities;

View File

@ -59,6 +59,14 @@ abstract class ACreateEmpty {
*/
abstract public function getExtension(): string;
/**
* Mimetype of the resulting created file
*
* @since 18.0.0
* @return string
*/
abstract public function getMimetype(): string;
/**
* Add content when creating empty files
*

View File

@ -31,6 +31,10 @@ class CreateEmpty extends ACreateEmpty {
public function getExtension(): string {
return '.txt';
}
public function getMimetype(): string {
return 'text/plain';
}
}
class Editor implements IEditor {