add support to file extension on exports and exposers

This commit is contained in:
Jacson Passold 2018-05-15 18:28:43 -03:00
parent 3058014b49
commit fc91167c6c
2 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,7 @@ namespace Tainacan\Exposers\Types;
abstract class Type {
protected $mappers = true; // List of supported mapper, leave true for all
protected $extension = 'tnc'; // extension sufix for multi operation system compatibility
/**
* Change response after api callbacks
@ -19,7 +20,14 @@ abstract class Type {
*/
public abstract function rest_request_after_callbacks( $response, $handler, $request );
/**
* Return list of supported mappers for this type
*/
public function get_mappers() {
return apply_filters('tainacan-exporser-type-mappers', $this->mappers, $this);
}
public function get_extension() {
return $this->extension;
}
}

View File

@ -7,6 +7,13 @@ namespace Tainacan\Exposers\Types;
*
*/
class Xml extends Type {
/**
* {@inheritdoc}
* @see \Tainacan\Exposers\Types\Type::extension
* @var string
*/
protected $extension = 'xml';
/**
*
* {@inheritDoc}