Merge branch 'feature/456' of https://github.com/tainacan/tainacan into feature/456
This commit is contained in:
commit
502a9fb0ee
|
@ -57,7 +57,7 @@ class Item extends Entity {
|
|||
$array_item['url'] = get_permalink( $this->get_id() );
|
||||
$array_item['creation_date'] = $this->get_date_i18n( explode( ' ', $array_item['creation_date'] )[0] );
|
||||
$array_item['modification_date'] = $this->get_date_i18n( explode( ' ', $array_item['modification_date'] )[0] );
|
||||
|
||||
$array_item['document_mimetype'] = $this->get_document_mimetype();
|
||||
return apply_filters('tainacan-item-to-array', $array_item, $this);
|
||||
}
|
||||
|
||||
|
@ -275,6 +275,15 @@ class Item extends Entity {
|
|||
return $this->get_mapped_property( 'document_type' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the document mimetype
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_document_mimetype() {
|
||||
return $this->get_document_type() == 'attachment' ? get_post_mime_type($this->get_document()) : $this->get_document_type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the item document
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue