Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
weryques 2018-05-11 12:37:56 -03:00
commit 25522ad36c
2 changed files with 70 additions and 6 deletions

View File

@ -65,7 +65,7 @@ export default {
var l10n = _wpMediaViewsL10n; var l10n = _wpMediaViewsL10n;
wp.media.view.settings.post = { wp.media.view.settings.post = {
id: this.params.relatedPostId id: null
} }
this.params.flex_width = 0; this.params.flex_width = 0;
@ -87,7 +87,7 @@ export default {
title: this.params.button_labels.frame_title, title: this.params.button_labels.frame_title,
library: wp.media.query({ library: wp.media.query({
type: 'image', type: 'image',
uploadedTo: this.params.relatedPostId uploadedTo: null
}), }),
multiple: false, multiple: false,
date: false, date: false,
@ -125,7 +125,7 @@ export default {
var l10n = _wpMediaViewsL10n; var l10n = _wpMediaViewsL10n;
wp.media.view.settings.post = { wp.media.view.settings.post = {
id: this.params.relatedPostId id: null
} }
this.params.flex_width = tainacan_plugin.custom_header_support[0].flex_width ? 1 : 0; this.params.flex_width = tainacan_plugin.custom_header_support[0].flex_width ? 1 : 0;
this.params.flex_height = tainacan_plugin.custom_header_support[0].flex_height ? 1 : 0; this.params.flex_height = tainacan_plugin.custom_header_support[0].flex_height ? 1 : 0;
@ -140,7 +140,7 @@ export default {
}, },
library: wp.media.query({ library: wp.media.query({
type: 'image', type: 'image',
uploadedTo: this.params.relatedPostId uploadedTo: null
}), }),
uploader: true, uploader: true,
content: 'upload', // First view that is opened content: 'upload', // First view that is opened
@ -149,7 +149,7 @@ export default {
title: this.params.button_labels.frame_title, title: this.params.button_labels.frame_title,
library: wp.media.query({ library: wp.media.query({
type: 'image', type: 'image',
uploadedTo: this.params.relatedPostId uploadedTo: null
}), }),
multiple: false, multiple: false,
date: false, date: false,
@ -198,7 +198,7 @@ export default {
new wp.media.controller.Library({ new wp.media.controller.Library({
title: this.params.button_labels.frame_title, title: this.params.button_labels.frame_title,
library: wp.media.query({ library: wp.media.query({
uploadedTo: this.params.relatedPostId uploadedTo: null
}), }),
multiple: false, multiple: false,
date: false, date: false,

View File

@ -48,6 +48,70 @@ function tainacan_get_collection_id() {
return false; return false;
} }
/**
* When visiting a collection archive or single, returns the current collection object
*
* @uses tainacan_get_collection_id()
* @return \Tainacan\Entities\Collection | false
*/
function tainacan_get_collection() {
$collection_id = tainacan_get_collection_id();
if ( $collection_id ) {
$TainacanCollections = Repositories\Collections::get_instance();
$collection = $TainacanCollections->fetch($collection_id);
if ( $collection instanceof Entities\Collection ) {
return $collection;
}
return false;
}
}
/**
* When visiting a collection archive or single, returns the collection name
*
* @return string
*/
function tainacan_get_the_collection_name() {
$collection = tainacan_get_collection();
$name = '';
if ( $collection ) {
$name = $collection->get_name();
}
return $name;
}
/**
* When visiting a collection archive or single, prints the collection name
*
* @return void
*/
function tainacan_the_collection_name() {
echo tainacan_get_the_collection_name();
}
/**
* When visiting a collection archive or single, returns the collection description
*
* @return string
*/
function tainacan_get_the_collection_description() {
$collection = tainacan_get_collection();
$description = '';
if ( $collection ) {
$description = $collection->get_description();
}
return $description;
}
/**
* When visiting a collection archive or single, prints the collection description
*
* @return void
*/
function tainacan_the_collection_description() {
echo tainacan_get_the_collection_description();
}
/** /**
* When visiting a term archive, returns the current term object * When visiting a term archive, returns the current term object
* *