diff --git a/package-lock.json b/package-lock.json index 9e6ec88b6..c43b539b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1951,9 +1951,9 @@ } }, "buefy": { - "version": "0.8.6", - "resolved": "https://registry.npmjs.org/buefy/-/buefy-0.8.6.tgz", - "integrity": "sha512-7woxrdwANcnJbe7lofPxkJLGRRGIVwFXOo0kzEpiNB6alQj18NV6UrdAKse+LWCOADz+AeHe5gyc6qdgRjG5mw==", + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/buefy/-/buefy-0.8.8.tgz", + "integrity": "sha512-kTUnroPBLm998KFZbeJuUgJV+nJbDUJxw1c8gzeJoe+Mve73Nb3hi6AZpgrIH8FtXmh5r8nMBYBqwN54EtPWXg==", "requires": { "bulma": "0.7.5" } @@ -4767,9 +4767,9 @@ } }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "hmac-drbg": { @@ -5682,11 +5682,6 @@ "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, "lodash.tail": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", @@ -6714,9 +6709,9 @@ } }, "popper.js": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.14.3.tgz", - "integrity": "sha1-FDj5jQRqz3tNeM1QK/QYrGTU8JU=" + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.0.tgz", + "integrity": "sha512-+G+EkOPoE5S/zChTpmBSSDYmhXJ5PsW8eMhH8cP/CQHMFPBG/kC9Y5IIw6qNYgdJ+/COf0ddY2li28iHaZRSjw==" }, "portfinder": { "version": "1.0.17", @@ -8081,9 +8076,9 @@ } }, "sortablejs": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.7.0.tgz", - "integrity": "sha1-gKKyNwq9Vo4c7IwnETHvMKkE+ig=" + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.10.1.tgz", + "integrity": "sha512-N6r7GrVmO8RW1rn0cTdvK3JR0BcqecAJ0PmYMCL3ZuqTH3pY+9QyqkmJSkkLyyDvd+AJnwaxTP22Ybr/83V9hQ==" }, "source-list-map": { "version": "2.0.0", @@ -9072,13 +9067,13 @@ "dev": true }, "v-tooltip": { - "version": "2.0.0-rc.33", - "resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-2.0.0-rc.33.tgz", - "integrity": "sha1-ePfY6cNCZWIr5lup3HjGfx3AK3M=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-2.0.2.tgz", + "integrity": "sha512-xQ+qzOFfywkLdjHknRPgMMupQNS8yJtf9Utd5Dxiu/0n4HtrxqsgDtN2MLZ0LKbburtSAQgyypuE/snM8bBZhw==", "requires": { - "lodash.merge": "^4.6.0", - "popper.js": "^1.12.9", - "vue-resize": "^0.4.3" + "lodash": "^4.17.11", + "popper.js": "^1.15.0", + "vue-resize": "^0.4.5" } }, "v8-compile-cache": { @@ -9122,9 +9117,9 @@ } }, "vue": { - "version": "2.5.17", - "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.17.tgz", - "integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==" + "version": "2.6.10", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", + "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" }, "vue-awesome-swiper": { "version": "3.1.3", @@ -9222,9 +9217,9 @@ "integrity": "sha512-viecHQiHVLez7HlYUQsv1wJb2MT/RDSzkDp6m3In41vPrk6OsBmT2qRE8LZqYIA4daIwrnx/Xm8h4fjOpuE3hw==" }, "vue-resize": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-0.4.4.tgz", - "integrity": "sha512-Lb/cnE2N9Y42ZJPw8wpjkpuX5a9ReerWNGcQRcbNCwfCnkHG6++FurNNmLIdU8dcCTH4c5rtTPdxBqFoRMK2cQ==" + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-0.4.5.tgz", + "integrity": "sha512-bhP7MlgJQ8TIkZJXAfDf78uJO+mEI3CaLABLjv0WNzr4CcGRGPIAItyWYnP6LsPA4Oq0WE+suidNs6dgpO4RHg==" }, "vue-router": { "version": "3.0.1", @@ -9242,9 +9237,9 @@ } }, "vue-template-compiler": { - "version": "2.5.17", - "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.5.17.tgz", - "integrity": "sha512-63uI4syCwtGR5IJvZM0LN5tVsahrelomHtCxvRkZPJ/Tf3ADm1U1wG6KWycK3qCfqR+ygM5vewUvmJ0REAYksg==", + "version": "2.6.10", + "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz", + "integrity": "sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg==", "dev": true, "requires": { "de-indent": "^1.0.2", @@ -9263,11 +9258,11 @@ "integrity": "sha512-UquSfnSWejD0zAfcD+3jJ1chUAkOAyoxya9Lxh9acCRtrlmGcAIvd0cQYraWqKenbuZJUdum+S174atv2AuEHQ==" }, "vuedraggable": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.16.0.tgz", - "integrity": "sha512-fr9gcWKXMJlzbbtJcrQs4kU7qdOZqd4SEpAcx+r0nykbW8AygZN0aKVpadEtI53T8A2azhzCdXMvEqrLuKE2fA==", + "version": "2.23.2", + "resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.23.2.tgz", + "integrity": "sha512-PgHCjUpxEAEZJq36ys49HfQmXglattf/7ofOzUrW2/rRdG7tu6fK84ir14t1jYv4kdXewTEa2ieKEAhhEMdwkQ==", "requires": { - "sortablejs": "^1.7.0" + "sortablejs": "^1.10.1" } }, "vuex": { diff --git a/package.json b/package.json index 9adf8c99c..2ea2f12db 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "axios": "^0.19.0", - "buefy": "^0.8.6", + "buefy": "^0.8.8", "bulma": "^0.7.5", "mdi": "^2.2.43", "moment": "^2.22.2", @@ -17,13 +17,13 @@ "react": "^16.8.3", "react-dom": "^16.8.3", "t": "^0.5.1", - "v-tooltip": "^2.0.0-rc.33", - "vue": "^2.5.17", + "v-tooltip": "^2.0.2", + "vue": "^2.5.22", "vue-awesome-swiper": "^3.1.3", "vue-masonry-css": "^1.0.3", "vue-router": "^3.0.1", "vue-the-mask": "^0.11.1", - "vuedraggable": "^2.16.0", + "vuedraggable": "^2.23.2", "vuex": "^3.0.1" }, "devDependencies": { @@ -43,7 +43,7 @@ "style-loader": "^0.23.1", "terser-webpack-plugin": "^1.1.0", "vue-loader": "^15.4.2", - "vue-template-compiler": "^2.5.17", + "vue-template-compiler": "^2.5.22", "webpack": "^4.22.0", "webpack-bundle-analyzer": "^3.3.2", "webpack-cli": "^3.1.2", diff --git a/src/admin/components/edition/importer-mapping-form.vue b/src/admin/components/edition/importer-mapping-form.vue index c64fd3f4f..09191f502 100644 --- a/src/admin/components/edition/importer-mapping-form.vue +++ b/src/admin/components/edition/importer-mapping-form.vue @@ -49,15 +49,15 @@
+ +diff --git a/src/gutenberg-blocks/tainacan-items/items-list/items-list.scss b/src/gutenberg-blocks/tainacan-items/items-list/items-list.scss index d3a1031d3..7be8b7a13 100644 --- a/src/gutenberg-blocks/tainacan-items/items-list/items-list.scss +++ b/src/gutenberg-blocks/tainacan-items/items-list/items-list.scss @@ -1,7 +1,7 @@ @import '../../gutenberg-blocks-style.scss'; .wp-block-tainacan-items-list { - margin: 2rem 0px; + margin: 2rem auto; // Spinner .components-spinner { @@ -9,6 +9,14 @@ right: 0; } + // For all view modes ------------------------------------------------ + ul.items-list li.item-list-item > button, + ul.items-list li.item-list-item > button:hover { + display: none; + visibility: hidden; + opacity: 0; + } + // Grid View Mode ---------------------------------------------------- ul.items-list.items-list-without-margin, ul.items-list-edit.items-list-without-margin { diff --git a/src/gutenberg-blocks/tainacan-items/items-list/items-modal.js b/src/gutenberg-blocks/tainacan-items/items-list/items-modal.js index b36c050bb..e58f01c96 100644 --- a/src/gutenberg-blocks/tainacan-items/items-list/items-modal.js +++ b/src/gutenberg-blocks/tainacan-items/items-list/items-modal.js @@ -49,7 +49,7 @@ export default class ItemsModal extends React.Component { if (this.props.existingCollectionId != null && this.props.existingCollectionId != undefined) { this.fetchCollection(this.props.existingCollectionId); this.setState({ - searchURL: this.props.existingSearchURL ? this.props.existingSearchURL : tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#/collections/'+ this.props.existingCollectionId + '/items/?iframemode=true' }); + searchURL: this.props.existingSearchURL ? this.props.existingSearchURL : tainacan_blocks.admin_url + 'admin.php?page=tainacan_admin#/collections/'+ this.props.existingCollectionId + '/items/?iframemode=true' }); } else { this.setState({ collectionPage: 1 }); this.fetchModalCollections(); @@ -85,7 +85,7 @@ export default class ItemsModal extends React.Component { let anItemsRequestSource = axios.CancelToken.source(); - let endpoint = '/collection/' + this.state.collectionId + '/items?'+ qs.stringify({ postin: selectedItems }) + '&fetch_only=title,url,thumbnail'; + let endpoint = '/collection/' + this.state.collectionId + '/items?'+ qs.stringify({ postin: selectedItems, perpage: selectedItems.length }) + '&fetch_only=title,url,thumbnail'; tainacan.get(endpoint, { cancelToken: anItemsRequestSource.token }) .then(response => { @@ -174,7 +174,7 @@ export default class ItemsModal extends React.Component { selectCollection(selectedCollectionId) { this.setState({ collectionId: selectedCollectionId, - searchURL: tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#/collections/' + selectedCollectionId + '/items/?iframemode=true' + searchURL: tainacan_blocks.admin_url + 'admin.php?page=tainacan_admin#/collections/' + selectedCollectionId + '/items/?iframemode=true' }); this.props.onSelectCollection(selectedCollectionId); diff --git a/src/gutenberg-blocks/tainacan-items/search-bar/index.js b/src/gutenberg-blocks/tainacan-items/search-bar/index.js index a71172a3f..e62824bd4 100644 --- a/src/gutenberg-blocks/tainacan-items/search-bar/index.js +++ b/src/gutenberg-blocks/tainacan-items/search-bar/index.js @@ -57,7 +57,7 @@ registerBlockType('tainacan/search-bar', { }, placeholderText: { type: String, - default: __('Search', 'taincan') + default: __('Search', 'tainacan') }, showCollectionHeader: { type: Boolean, @@ -169,13 +169,13 @@ registerBlockType('tainacan/search-bar', { (alignment == 'left' ? ' is-aligned-left' : '') + (alignment == 'right' ? ' is-aligned-right' : '') } - id="taincan-search-bar-block" - action={ tainacan_plugin.site_url + '/' + collectionSlug + '/#/' } + id="tainacan-search-bar-block" + action={ tainacan_blocks.site_url + '/' + collectionSlug + '/#/' } method='get'> @@ -214,13 +214,13 @@ registerBlockType('tainacan/search-bar', { (alignment == 'left' ? ' is-aligned-left' : '') + (alignment == 'right' ? ' is-aligned-right' : '') } - id="taincan-search-bar-block" - action={ tainacan_plugin.site_url + '/' + collectionSlug + '/#/' } + id="tainacan-search-bar-block" + action={ tainacan_blocks.site_url + '/' + collectionSlug + '/#/' } method='get'> @@ -494,7 +494,7 @@ registerBlockType('tainacan/search-bar', { icon={( )}>
@@ -560,11 +560,11 @@ registerBlockType('tainacan/search-bar', {
(alignment == 'left' ? ' is-aligned-left' : '') +
(alignment == 'right' ? ' is-aligned-right' : '')
}
- id="taincan-search-bar-block">
+ id="tainacan-search-bar-block">
@@ -606,11 +606,11 @@ registerBlockType('tainacan/search-bar', {
(alignment == 'left' ? ' is-aligned-left' : '') +
(alignment == 'right' ? ' is-aligned-right' : '')
}
- id="taincan-search-bar-block">
+ id="tainacan-search-bar-block">
diff --git a/src/gutenberg-blocks/tainacan-items/search-bar/search-bar-modal.js b/src/gutenberg-blocks/tainacan-items/search-bar/search-bar-modal.js
index 88e8efbb0..384214f50 100644
--- a/src/gutenberg-blocks/tainacan-items/search-bar/search-bar-modal.js
+++ b/src/gutenberg-blocks/tainacan-items/search-bar/search-bar-modal.js
@@ -106,7 +106,7 @@ export default class SearchBarModal extends React.Component {
label: __('Repository items', 'tainacan'),
name: __('Repository items', 'tainacan'),
id: 'default',
- slug: tainacan_plugin.theme_items_list_url.split('/')[tainacan_plugin.theme_items_list_url.split('/').length - 1]
+ slug: tainacan_blocks.theme_items_list_url.split('/')[tainacan_blocks.theme_items_list_url.split('/').length - 1]
};
else {
selectedCollection = this.state.modalCollections.find((collection) => collection.id == selectedCollectionId)
@@ -269,7 +269,7 @@ export default class SearchBarModal extends React.Component {
@@ -545,8 +545,8 @@ registerBlockType('tainacan/carousel-terms-list', {
hide-name={ '' + hideName }
max-terms-number={ maxTermsNumber }
taxonomy-id={ taxonomyId }
- tainacan-api-root={ tainacan_plugin.root }
- tainacan-base-url={ tainacan_plugin.base_url }
+ tainacan-api-root={ tainacan_blocks.root }
+ tainacan-base-url={ tainacan_blocks.base_url }
show-term-thumbnail={ '' + showTermThumbnail }
id={ 'wp-block-tainacan-carousel-terms-list_' + blockId }>
{ content }
diff --git a/src/gutenberg-blocks/tainacan-terms/terms-list/index.js b/src/gutenberg-blocks/tainacan-terms/terms-list/index.js
index b2ba89c73..d164cbb37 100644
--- a/src/gutenberg-blocks/tainacan-terms/terms-list/index.js
+++ b/src/gutenberg-blocks/tainacan-terms/terms-list/index.js
@@ -121,7 +121,7 @@ registerBlockType('tainacan/terms-list', {
target="_blank"
className={ (!showName ? 'term-without-name' : '') + ' ' + (!showImage ? 'term-without-image' : '') }>
{ term.name ? term.name : '' }
@@ -290,7 +290,7 @@ registerBlockType('tainacan/terms-list', {
icon={(
)}>
diff --git a/src/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss b/src/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss
index 0475da79e..ac6051f45 100644
--- a/src/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss
+++ b/src/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss
@@ -1,7 +1,7 @@
@import '../../gutenberg-blocks-style.scss';
.wp-block-tainacan-terms-list {
- margin: 2rem 0px;
+ margin: 2rem auto;
// Spinner
.components-spinner {
@@ -9,6 +9,14 @@
right: 0;
}
+ // For all view modes ------------------------------------------------
+ ul.terms-list li.term-list-item > button,
+ ul.terms-list li.term-list-item > button:hover {
+ display: none;
+ visibility: hidden;
+ opacity: 0;
+ }
+
// Grid View Mode ----------------------------------------------------
ul.terms-list.terms-layout-grid,
ul.terms-list-edit.terms-layout-grid {
diff --git a/src/gutenberg-blocks/tainacan-terms/terms-list/terms-modal.js b/src/gutenberg-blocks/tainacan-terms/terms-list/terms-modal.js
index cdf8b316d..e135c954b 100644
--- a/src/gutenberg-blocks/tainacan-terms/terms-list/terms-modal.js
+++ b/src/gutenberg-blocks/tainacan-terms/terms-list/terms-modal.js
@@ -363,7 +363,7 @@ export default class TermsModal extends React.Component {
{ term.header_image ?
: null
}
@@ -396,7 +396,7 @@ export default class TermsModal extends React.Component {
{ term.header_image ?
: null
}
diff --git a/src/js/event-bus-web-components.js b/src/js/event-bus-web-components.js
index c96a85589..be06ea339 100644
--- a/src/js/event-bus-web-components.js
+++ b/src/js/event-bus-web-components.js
@@ -34,8 +34,10 @@ export const eventBus = new Vue({
.then(() => {
this.$emit('isUpdatingValue', false);
let index = this.errors.findIndex( errorItem => errorItem.metadatum_id == metadatumId );
- if (index >= 0)
+ if (index >= 0) {
this.errors.splice( index, 1);
+ }
+ this.$emit('updateErrorMessageOf#' + metadatumId, this.errors[index]);
})
.catch((error) => {
this.$emit('isUpdatingValue', false);
@@ -45,17 +47,17 @@ export const eventBus = new Vue({
for (let index in error)
messages.push(error[index]);
- if ( index >= 0)
+ if ( index >= 0) {
Vue.set( this.errors, index, { metadatum_id: metadatumId, errors: messages });
- else
+ this.$emit('updateErrorMessage', this.errors[index]);
+ } else {
this.errors.push( { metadatum_id: metadatumId, errors: messages } );
+ this.$emit('updateErrorMessageOf#' + metadatumId, this.errors[0]);
+ }
+
});
}
},
- getErrors(metadatum_id) {
- let error = this.errors.find(errorItem => errorItem.metadatum_id == metadatum_id);
- return error ? error.errors : false
- },
clearAllErrors() {
this.errors = [];
}
diff --git a/src/js/store/modules/taxonomy/actions.js b/src/js/store/modules/taxonomy/actions.js
index 685a45e1d..84c8c62c1 100644
--- a/src/js/store/modules/taxonomy/actions.js
+++ b/src/js/store/modules/taxonomy/actions.js
@@ -174,9 +174,9 @@ export const updateTerm = ({ commit }, { taxonomyId, id, name, description, pare
export const fetchTerms = ({ commit }, {taxonomyId, fetchOnly, search, all, order, offset, number}) => {
let query = '';
- if (order == undefined) {
+
+ if (order == undefined)
order = 'asc';
- }
if(fetchOnly && search && !all ){
query = `?order=${order}&${qs.stringify(fetchOnly)}&${qs.stringify(search)}`;
@@ -188,9 +188,11 @@ export const fetchTerms = ({ commit }, {taxonomyId, fetchOnly, search, all, orde
query =`?hideempty=0&order=${order}`;
}
- if (offset != undefined && number != undefined) {
- query += '&offset=' + offset + '&number=' + number;
- }
+ if (number != undefined)
+ query += '&number=' + number;
+
+ if (offset != undefined)
+ query += '&offset=' + offset;
return new Promise((resolve, reject) => {
axios.tainacan.get(`/taxonomy/${taxonomyId}/terms${query}`)
diff --git a/src/migrations.php b/src/migrations.php
index f679a2b70..b1c58aa80 100644
--- a/src/migrations.php
+++ b/src/migrations.php
@@ -424,6 +424,11 @@ class Migrations {
$wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = 'document_content_index' WHERE meta_key = '_document_content_index'");
}
+ static function refresh_rewrite_rules_attachment_pages() {
+ // needed after we added the /tainacan_attachments url
+ flush_rewrite_rules(false);
+ }
+
}
diff --git a/src/readme.txt b/src/readme.txt
index c9034300a..684472b1a 100644
--- a/src/readme.txt
+++ b/src/readme.txt
@@ -2,9 +2,9 @@
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros
Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 4.8
-Tested up to: 5.2.4
+Tested up to: 5.3
Requires PHP: 5.6
-Stable tag: 0.13.1
+Stable tag: 0.14.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
diff --git a/src/tainacan.php b/src/tainacan.php
index 43a7b6af0..f6aa452e3 100644
--- a/src/tainacan.php
+++ b/src/tainacan.php
@@ -4,13 +4,13 @@ Plugin Name: Tainacan
Plugin URI: https://tainacan.org/
Description: Open source, powerfull and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional respository platform.
Author: Tainacan.org
-Version: 0.13.1
+Version: 0.14.2
Text Domain: tainacan
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
-const TAINACAN_VERSION = '0.13.1';
+const TAINACAN_VERSION = '0.14.2';
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
diff --git a/src/theme-helper/class-tainacan-theme-helper.php b/src/theme-helper/class-tainacan-theme-helper.php
index 9f14e76a1..8336f6c1f 100644
--- a/src/theme-helper/class-tainacan-theme-helper.php
+++ b/src/theme-helper/class-tainacan-theme-helper.php
@@ -365,19 +365,25 @@ class Theme_Helper {
$atts
);
+ $default_view_mode = apply_filters( 'tainacan-default-view-mode-for-themes', 'masonry' );
+ $enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', ['table', 'cards', 'masonry', 'slideshow'] );
+
$params = '';
- if (isset($atts['collection-id'])) {
- $params = "collection-id=" . $atts['collection-id'];
+ if (isset($atts['collection-id']) && $atts['collection-id'] != '') {
+ $params .= "collection-id=" . $atts['collection-id'];
+ $collection = new \Tainacan\Entities\Collection($atts['collection-id']);
+ $default_view_mode = $collection->get_default_view_mode();
+ $enabled_view_modes = $collection->get_enabled_view_modes();
}
- if (isset($atts['term-id'])) {
- $params = "term-id=" . $atts['term-id'];
+ if (isset($atts['term-id']) && $atts['term-id'] != '') {
+ $params .= "term-id=" . $atts['term-id'];
}
-
+
+ $params .= ' default-view-mode="' . $default_view_mode . '" ';
+ $params .= ' enabled-view-modes="' . implode(',', $enabled_view_modes) . '" ';
+
$this->enqueue_scripts(true);
-
return "