diff --git a/src/admin/class-tainacan-admin.php b/src/admin/class-tainacan-admin.php index 5a6955a98..0ab34ebe2 100644 --- a/src/admin/class-tainacan-admin.php +++ b/src/admin/class-tainacan-admin.php @@ -134,7 +134,7 @@ class Admin { * Also used by DevInterface */ function get_admin_js_localization_params() { - global $TAINACAN_BASE_URL; + global $TAINACAN_BASE_URL, $TAINACAN_API_MAX_ITEMS_PER_PAGE; $Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance(); $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); @@ -171,8 +171,8 @@ class Admin { } $settings = [ - 'root' => esc_url_raw( rest_url() ) . 'tainacan/v2', - 'root_wp_api' => esc_url_raw( rest_url() ) . 'wp/v2/', + 'tainacan_api_url' => esc_url_raw( rest_url() ) . 'tainacan/v2', + 'wp_api_url' => esc_url_raw( rest_url() ) . 'wp/v2/', 'wp_ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'components' => $components, @@ -184,9 +184,10 @@ class Admin { 'theme_collection_list_url' => get_post_type_archive_link( 'tainacan-collection' ), 'custom_header_support' => get_theme_support('custom-header'), 'registered_view_modes' => \Tainacan\Theme_Helper::get_instance()->get_registered_view_modes(), - 'exposer_mapper_param' => \Tainacan\Exposers\Exposers::MAPPER_PARAM, - 'exposer_type_param' => \Tainacan\Exposers\Exposers::TYPE_PARAM, - 'repository_name' => get_bloginfo('name') + 'exposer_mapper_param' => \Tainacan\Mappers_Handler::MAPPER_PARAM, + 'exposer_type_param' => \Tainacan\Exposers_Handler::TYPE_PARAM, + 'repository_name' => get_bloginfo('name'), + 'api_max_items_per_page' => $TAINACAN_API_MAX_ITEMS_PER_PAGE, ]; $maps = [ diff --git a/src/admin/components/edition/exporter-edition-form.vue b/src/admin/components/edition/exporter-edition-form.vue index cb165d415..11caa4af8 100644 --- a/src/admin/components/edition/exporter-edition-form.vue +++ b/src/admin/components/edition/exporter-edition-form.vue @@ -35,17 +35,19 @@ Object.keys(exporterSession.mapping_accept).length && exporterSession.mapping_accept.any" :label="$i18n.get('mapping')"> -
- - {{ key.replace(/-/, ' ') }} - -
+ v-model="selectedMappings" + > + + + diff --git a/src/admin/components/lists/items-list.vue b/src/admin/components/lists/items-list.vue index c2f7afa83..18c454521 100644 --- a/src/admin/components/lists/items-list.vue +++ b/src/admin/components/lists/items-list.vue @@ -25,7 +25,7 @@ -
+
+ + +
+ +
-
- -
@@ -666,6 +673,7 @@ import { mapActions, mapGetters } from 'vuex'; import CustomDialog from '../other/custom-dialog.vue'; import BulkEditionModal from '../bulk-edition/bulk-edition-modal.vue'; +import ExposersModal from '../other/exposers-modal.vue'; export default { name: 'ItemsList', @@ -711,15 +719,13 @@ export default { this.queryAllItemsSelected = {}; } else if(item === true) { isSelecting = true; - this.selectedItemsIDs.splice(index, 1, this.items[index].id); } }); - if(!allSelected) { + if (!allSelected) this.isAllItemsSelected = allSelected; - } - + this.allItemsOnPageSelected = allSelected; this.isSelectingItems = isSelecting; }, @@ -930,7 +936,18 @@ export default { getLimitedDescription(description) { let maxCharacter = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 480 ? 100 : 210; return description.length > maxCharacter ? description.substring(0, maxCharacter - 3) + '...' : description; - } + }, + openExposersModal() { + this.$modal.open({ + parent: this, + component: ExposersModal, + hasModalCard: true, + props: { + collectionId: this.collectionId, + totalItems: this.totalItems + } + }) + }, } } @@ -938,9 +955,9 @@ export default { + + + diff --git a/src/admin/components/search/skeleton-items-list.vue b/src/admin/components/search/skeleton-items-list.vue new file mode 100644 index 000000000..770824a29 --- /dev/null +++ b/src/admin/components/search/skeleton-items-list.vue @@ -0,0 +1,255 @@ + + + + + \ No newline at end of file diff --git a/src/admin/js/utilities.js b/src/admin/js/utilities.js index 63a72479e..0b065107b 100644 --- a/src/admin/js/utilities.js +++ b/src/admin/js/utilities.js @@ -2,7 +2,7 @@ import qs from 'qs'; import axios from 'axios'; const wpApi = axios.create({ - baseURL: tainacan_plugin.root_wp_api + baseURL: tainacan_plugin.wp_api_url }); wpApi.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; diff --git a/src/admin/pages/lists/items-page.vue b/src/admin/pages/lists/items-page.vue index 30bc0e229..b360e9b3a 100644 --- a/src/admin/pages/lists/items-page.vue +++ b/src/admin/pages/lists/items-page.vue @@ -100,14 +100,14 @@ = 0 && isRepositoryLevel) || filters.length > 0)" :filters="filters" :collapsed="collapseAll" :is-repository-level="isRepositoryLevel"/>

@@ -445,6 +445,20 @@

+ +
+ +
+
@@ -545,12 +559,13 @@
- + :active="showLoading"/>--> +
- = 0 && isRepositoryLevel) || filters.length > 0)" :filters="filters" :collapsed="collapseAll" :is-repository-level="isRepositoryLevel"/>

@@ -744,8 +758,10 @@ import FiltersTagsList from '../../components/search/filters-tags-list.vue'; import FiltersItemsList from '../../components/search/filters-items-list.vue'; import Pagination from '../../components/search/pagination.vue' + import SkeletonItemsList from '../../components/search/skeleton-items-list.vue' import AdvancedSearch from '../../components/advanced-search/advanced-search.vue'; import AvailableImportersModal from '../../components/other/available-importers-modal.vue'; + import ExposersModal from '../../components/other/exposers-modal.vue'; import CollectionsModal from '../../components/other/collections-modal.vue'; import { mapActions, mapGetters } from 'vuex'; @@ -842,8 +858,10 @@ ItemsList, FiltersTagsList, FiltersItemsList, + SkeletonItemsList, Pagination, AdvancedSearch, + ExposersModal }, watch: { displayedMetadata() { @@ -915,6 +933,17 @@ } }); }, + openExposersModal() { + this.$modal.open({ + parent: this, + component: ExposersModal, + hasModalCard: true, + props: { + collectionId: this.collectionId, + totalItems: this.totalItems + } + }) + }, onOpenCollectionsModal() { this.$modal.open({ parent: this, diff --git a/src/admin/pages/lists/term-items-page.vue b/src/admin/pages/lists/term-items-page.vue index 4d665f633..736a0392b 100644 --- a/src/admin/pages/lists/term-items-page.vue +++ b/src/admin/pages/lists/term-items-page.vue @@ -73,10 +73,10 @@

- {{ $i18n.get('advanced_search') }} - + -->

{{ $i18n.get('filters') }}

- {{ $i18n.get('advanced_search') }} + class="is-size-7 has-text-secondary is-pulled-right">{{ $i18n.get('advanced_search') }} -->
@@ -470,8 +470,8 @@
- + +

{ - this.searchControlHeight = this.$refs['search-control'].clientHeight; + if (this.$refs['search-control'] != undefined) + this.searchControlHeight = this.$refs['search-control'].clientHeight; }, 500); }, onChangeAdminViewMode(adminViewMode) { diff --git a/src/admin/scss/_variables.scss b/src/admin/scss/_variables.scss index 0dd45d73a..6cf405d9c 100644 --- a/src/admin/scss/_variables.scss +++ b/src/admin/scss/_variables.scss @@ -597,13 +597,19 @@ $modal-z: 9999999; 100%{background-position:0% 94%} } +// .skeleton:nth-child(even) { +// background: linear-gradient(105deg, #f0f0f0, #fbfbfb, #eeeeee); +// } +// .skeleton:nth-child(odd) { +// background: linear-gradient(235deg, #f0f0f0, #fbfbfb, #eeeeee); +// } .skeleton { - border-radius: 6px; - background: linear-gradient(235deg, #fbfbfb, #ffffff, #eeeeee); + border-radius: 4px; + background: linear-gradient(235deg, #f0f0f0, #fbfbfb, #eeeeee); background-size: 600% 600%; - -webkit-animation: skeleton-animation 1s ease infinite; - -moz-animation: skeleton-animation 1s ease infinite; - -o-animation: skeleton-animation 1s ease infinite; - animation: skeleton-animation 1s ease infinite; + -webkit-animation: skeleton-animation 1.5s ease infinite; + -moz-animation: skeleton-animation 1.5s ease infinite; + -o-animation: skeleton-animation 1.5s ease infinite; + animation: skeleton-animation 1.5s ease infinite; } \ No newline at end of file diff --git a/src/admin/scss/_view-mode-cards.scss b/src/admin/scss/_view-mode-cards.scss index 98612b66d..3b76ede85 100644 --- a/src/admin/scss/_view-mode-cards.scss +++ b/src/admin/scss/_view-mode-cards.scss @@ -6,7 +6,7 @@ grid-template-columns: repeat(auto-fill, 455px); grid-gap: 0px; justify-content: space-evenly; - animation-name: item-appear; + animation-name: appear; animation-duration: 0.5s; @media screen and (max-width: 480px) { diff --git a/src/admin/scss/_view-mode-grid.scss b/src/admin/scss/_view-mode-grid.scss index be1384eba..299f76e9e 100644 --- a/src/admin/scss/_view-mode-grid.scss +++ b/src/admin/scss/_view-mode-grid.scss @@ -6,7 +6,7 @@ grid-template-columns: repeat(auto-fill, 285px); grid-gap: 0px; justify-content: space-evenly; - animation-name: item-appear; + animation-name: appear; animation-duration: 0.5s; .selected-grid-item { @@ -15,6 +15,7 @@ .tainacan-grid-item { max-width: 255px; + min-height: 300px; flex-basis: 0; margin: 15px; text-align: center; diff --git a/src/admin/scss/_view-mode-masonry.scss b/src/admin/scss/_view-mode-masonry.scss index 27e8916f4..7027ce5f4 100644 --- a/src/admin/scss/_view-mode-masonry.scss +++ b/src/admin/scss/_view-mode-masonry.scss @@ -6,7 +6,7 @@ flex-grow: 1; flex-shrink: 1; justify-content: space-evenly; - animation-name: item-appear; + animation-name: appear; animation-duration: 0.5s; .selected-masonry-item { diff --git a/src/admin/scss/_view-mode-records.scss b/src/admin/scss/_view-mode-records.scss index 208d14ac6..ee2fbc0b4 100644 --- a/src/admin/scss/_view-mode-records.scss +++ b/src/admin/scss/_view-mode-records.scss @@ -6,7 +6,7 @@ flex-grow: 1; flex-shrink: 1; justify-content: space-evenly; - animation-name: item-appear; + animation-name: appear; animation-duration: 0.5s; .selected-record { diff --git a/src/admin/scss/tainacan-admin.scss b/src/admin/scss/tainacan-admin.scss index 3c72ca105..1732a0bbc 100644 --- a/src/admin/scss/tainacan-admin.scss +++ b/src/admin/scss/tainacan-admin.scss @@ -51,6 +51,9 @@ html { } // Tainacan Loading +.loading-overlay { + z-index: 9999999999; +} .loading-overlay .loading-icon::after { background-image: url('../../admin/images/tainacan_loading.gif'); border: none; diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php index f6ca45825..4e36fc286 100644 --- a/src/admin/tainacan-admin-i18n.php +++ b/src/admin/tainacan-admin-i18n.php @@ -338,6 +338,8 @@ return apply_filters( 'tainacan-admin-i18n', [ 'label_available_exporters' => __( 'Available Exporters', 'tainacan' ), 'label_origin_collection' => __( 'Origin collection', 'tainacan'), 'label_send_email' => __( 'Send a email after exportation completed', 'tainacan' ), + 'label_urls' => __( 'URLs', 'tainacan' ), + 'label_page' => __( 'Page', 'tainacan' ), 'label_activity_description' => __( 'Activity description', 'tainacan' ), 'label_activity_creation_date' => __( 'Activity creation date', 'tainacan' ), 'label_activity_author' => __( 'Activity author', 'tainacan' ), diff --git a/src/api/endpoints/class-tainacan-rest-collections-controller.php b/src/api/endpoints/class-tainacan-rest-collections-controller.php index a36a5f126..8da159ea4 100644 --- a/src/api/endpoints/class-tainacan-rest-collections-controller.php +++ b/src/api/endpoints/class-tainacan-rest-collections-controller.php @@ -302,6 +302,8 @@ class REST_Collections_Controller extends REST_Controller { $collection = $this->collections_repository->insert( $prepared_post ); $response = $this->prepare_item_for_response($collection, $request); + + do_action('tainacan-api-collection-created', $response, $request); return new \WP_REST_Response($response, 201); } diff --git a/src/api/endpoints/class-tainacan-rest-export-controller.php b/src/api/endpoints/class-tainacan-rest-export-controller.php index 485ac3df5..b28959e56 100644 --- a/src/api/endpoints/class-tainacan-rest-export-controller.php +++ b/src/api/endpoints/class-tainacan-rest-export-controller.php @@ -140,7 +140,7 @@ class REST_Export_Controller extends REST_Controller { */ public function export($request, $query, $args) { - $type = \Tainacan\Exposers\Exposers::request_has_type($request); + $type = \Tainacan\Exposers_Handler::request_has_type($request); $path = wp_upload_dir(); $path = $path['path']; $filename = $path.date('YmdHis').'-tainacan-export.'.$type->get_extension(); @@ -170,8 +170,8 @@ class REST_Export_Controller extends REST_Controller { [], 'error' ); - remove_filter( 'rest_request_after_callbacks', [\Tainacan\Exposers\Exposers::get_instance(), 'rest_request_after_callbacks'], 10, 3 ); //exposer mapping - remove_filter( 'tainacan-rest-response', [\Tainacan\Exposers\Exposers::get_instance(), 'rest_response'], 10, 2 ); // exposer types + remove_filter( 'rest_request_after_callbacks', [\Tainacan\Exposers_Handler::get_instance(), 'rest_request_after_callbacks'], 10, 3 ); //exposer mapping + remove_filter( 'tainacan-rest-response', [\Tainacan\Exposers_Handler::get_instance(), 'rest_response'], 10, 2 ); // exposer types return $log; } elseif ($pid) { // we are the parent or run at foreground try { @@ -265,8 +265,8 @@ class REST_Export_Controller extends REST_Controller { } } else { // we are the child - remove_filter( 'rest_request_after_callbacks', [\Tainacan\Exposers\Exposers::get_instance(), 'rest_request_after_callbacks'], 10, 3 ); //exposer mapping - remove_filter( 'tainacan-rest-response', [\Tainacan\Exposers\Exposers::get_instance(), 'rest_response'], 10, 2 ); // exposer types + remove_filter( 'rest_request_after_callbacks', [\Tainacan\Exposers_Handler::get_instance(), 'rest_request_after_callbacks'], 10, 3 ); //exposer mapping + remove_filter( 'tainacan-rest-response', [\Tainacan\Exposers_Handler::get_instance(), 'rest_response'], 10, 2 ); // exposer types return $log; } diff --git a/src/api/endpoints/class-tainacan-rest-exposers-controller.php b/src/api/endpoints/class-tainacan-rest-exposers-controller.php new file mode 100644 index 000000000..b8a6771da --- /dev/null +++ b/src/api/endpoints/class-tainacan-rest-exposers-controller.php @@ -0,0 +1,80 @@ +rest_base = 'exposers'; + parent::__construct(); + add_action('init', array(&$this, 'init_objects'), 11); + } + + /** + * Initialize objects after post_type register + */ + public function init_objects() { + $this->exposers = Exposers_Handler::get_instance(); + $this->mappers = Mappers_Handler::get_instance(); + } + + public function register_routes() { + + register_rest_route($this->namespace, '/' . $this->rest_base, array( + array( + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array($this, 'get_items'), + 'permission_callback' => array($this, 'get_items_permissions_check') + ) + )); + } + + /** + * @param \WP_REST_Request $request + * + * @return \WP_Error|\WP_REST_Response + */ + public function get_items( $request ) { + + $exposers = $this->exposers->get_exposers(); + + $response = []; + + + foreach ($exposers as $exposer) { + if ( class_exists($exposer) ) { + $e = new $exposer(); + $response[] = $e->_toArray(); + } + } + + $rest_response = new \WP_REST_Response($response, 200); + + $rest_response->header('X-WP-Total', count($response)); + + return $rest_response; + + } + + /** + * @param \WP_REST_Request $request + * + * @return bool|\WP_Error + */ + public function get_items_permissions_check( $request ) { + return true; + } + +} + +?> \ No newline at end of file diff --git a/src/api/endpoints/class-tainacan-rest-facets-controller.php b/src/api/endpoints/class-tainacan-rest-facets-controller.php index 9b091ed34..95e8eba01 100644 --- a/src/api/endpoints/class-tainacan-rest-facets-controller.php +++ b/src/api/endpoints/class-tainacan-rest-facets-controller.php @@ -54,6 +54,9 @@ class REST_Facets_Controller extends REST_Controller { */ public function get_items( $request ) { + // Free php session early so simultaneous requests dont get queued + session_write_close(); + $metadatum_id = $request['metadatum_id']; if( !empty($metadatum_id) ) { diff --git a/src/api/endpoints/class-tainacan-rest-items-controller.php b/src/api/endpoints/class-tainacan-rest-items-controller.php index 66892f292..547f07470 100644 --- a/src/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/api/endpoints/class-tainacan-rest-items-controller.php @@ -119,12 +119,13 @@ class REST_Items_Controller extends REST_Controller { $item_array['metadata'][ $slug ]['name'] = $metadatum->get_name(); if($metadatum->get_metadata_type_object()->get_primitive_type() === 'date') { $item_array['metadata'][ $slug ]['date_i18n'] = $item_metadata_array['date_i18n']; - } else { - $item_array['metadata'][ $slug ]['value'] = $item_metadata_array['value']; - $item_array['metadata'][ $slug ]['value_as_html'] = $item_metadata_array['value_as_html']; - $item_array['metadata'][ $slug ]['value_as_string'] = $item_metadata_array['value_as_string']; } + $item_array['metadata'][ $slug ]['value'] = $item_metadata_array['value']; + $item_array['metadata'][ $slug ]['value_as_html'] = $item_metadata_array['value_as_html']; + $item_array['metadata'][ $slug ]['value_as_string'] = $item_metadata_array['value_as_string']; + $item_array['metadata'][ $slug ]['multiple'] = $metadatum->get_multiple(); + $item_array['metadata'][ $slug ]['mapping'] = $metadatum->get_exposer_mapping(); } return $item_array; @@ -169,37 +170,41 @@ class REST_Items_Controller extends REST_Controller { } $item_arr['document_as_html'] = $item->get_document_html($img_size); - $item_arr['exposer_urls'] = \Tainacan\Exposers\Exposers::get_exposer_urls(rest_url("{$this->namespace}/{$this->rest_base}/{$item->get_id()}/")); - return $this->add_metadata_to_item( $item, $item_arr ); - } - - $attributes_to_filter = $request['fetch_only']; - - # Always returns id and collection id - if(is_array($attributes_to_filter)) { - $attributes_to_filter[] = 'id'; - $attributes_to_filter[] = 'collection_id'; + $item_arr['exposer_urls'] = \Tainacan\Exposers_Handler::get_exposer_urls(rest_url("{$this->namespace}/{$this->rest_base}/{$item->get_id()}/")); + $item_arr = $this->add_metadata_to_item( $item, $item_arr ); } else { - $attributes_to_filter = array($attributes_to_filter, 'id', 'collection_id'); + + $attributes_to_filter = $request['fetch_only']; + + # Always returns id and collection id + if(is_array($attributes_to_filter)) { + $attributes_to_filter[] = 'id'; + $attributes_to_filter[] = 'collection_id'; + } else { + $attributes_to_filter = array($attributes_to_filter, 'id', 'collection_id'); + } + + $item_arr = $this->filter_object_by_attributes($item, $attributes_to_filter); + + $item_arr = array_merge($extra_metadata_values, $item_arr); + + if(is_array($attributes_to_filter) && array_key_exists('meta', $attributes_to_filter)){ + + $args = array('post__in' => $attributes_to_filter['meta']); + + $item_arr = $this->add_metadata_to_item($item, $item_arr, $args); + } + + if ( $request['context'] === 'edit' ) { + $item_arr['current_user_can_edit'] = $item->can_edit(); + } + + $item_arr['url'] = get_permalink( $item_arr['id'] ); + $item_arr['exposer_urls'] = \Tainacan\Exposers_Handler::get_exposer_urls(get_rest_url(null, "{$this->namespace}/{$this->rest_base}/{$item->get_id()}/")); + } - $item_arr = $this->filter_object_by_attributes($item, $attributes_to_filter); - - $item_arr = array_merge($extra_metadata_values, $item_arr); - - if(is_array($attributes_to_filter) && array_key_exists('meta', $attributes_to_filter)){ - - $args = array('post__in' => $attributes_to_filter['meta']); - - $item_arr = $this->add_metadata_to_item($item, $item_arr, $args); - } - - if ( $request['context'] === 'edit' ) { - $item_arr['current_user_can_edit'] = $item->can_edit(); - } - - $item_arr['url'] = get_permalink( $item_arr['id'] ); - $item_arr['exposer_urls'] = \Tainacan\Exposers\Exposers::get_exposer_urls(get_rest_url(null, "{$this->namespace}/{$this->rest_base}/{$item->get_id()}/")); + $item_arr = apply_filters('tainacan-api-items-prepare-for-response', $item_arr, $item, $request); return $item_arr; } @@ -229,13 +234,36 @@ class REST_Items_Controller extends REST_Controller { * @throws \Exception */ public function get_items( $request ) { + + global $TAINACAN_API_MAX_ITEMS_PER_PAGE; + + // Free php session early so simultaneous requests dont get queued + session_write_close(); + $args = $this->prepare_filters($request); + /** + * allow plugins to hijack the process. + * + * If it returns a \WP_REST_Response, the method will return it and ignore the rest of the script + */ + $alternate_response = apply_filters('tainacan-api-get-items-alternate', false, $request); + if ( $alternate_response instanceof \WP_REST_Response ) { + return $alternate_response; + } + $collection_id = []; if($request['collection_id']) { $collection_id = $request['collection_id']; } + $max_items_per_page = $TAINACAN_API_MAX_ITEMS_PER_PAGE; + if ( $max_items_per_page > -1 ) { + if ( isset($args['posts_per_page']) && (int) $args['posts_per_page'] > $max_items_per_page ) { + $args['posts_per_page'] = $max_items_per_page; + } + } + $query_start = microtime(true); $items = $this->items_repository->fetch($args, $collection_id, 'WP_Query'); @@ -297,6 +325,7 @@ class REST_Items_Controller extends REST_Controller { $rest_response->header('X-WP-Total', (int) $total_items); $rest_response->header('X-WP-TotalPages', (int) $max_pages); + $rest_response->header('X-WP-ItemsPerPage', (int) $items->query_vars['posts_per_page']); $rest_response->header('X-Tainacan-Query-Time', $query_end - $query_start); $rest_response->header('X-Tainacan-Elapsed-Time', microtime(true) - $query_start); diff --git a/src/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php b/src/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php index 721280aeb..206df004f 100644 --- a/src/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php +++ b/src/api/endpoints/class-tainacan-rest-metadatum-mappers-controller.php @@ -65,9 +65,9 @@ class REST_Metadatum_Mappers_Controller extends REST_Controller { * @return \WP_Error|\WP_REST_Response */ public function get_items( $request ) { - $Tainacan_Exposers = \Tainacan\Exposers\Exposers::get_instance(); + $Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance(); - $metadatum_mappers = $Tainacan_Exposers->get_mappers( 'OBJECT' ); + $metadatum_mappers = $Tainacan_Mappers->get_mappers( 'OBJECT' ); $prepared = []; foreach ($metadatum_mappers as $metadatum_mapper){ @@ -101,7 +101,7 @@ class REST_Metadatum_Mappers_Controller extends REST_Controller { array_key_exists('metadata_mappers', $body) && is_array($body['metadata_mappers']) && count($body['metadata_mappers']) > 0 && - \Tainacan\Exposers\Exposers::request_has_mapper($request) + \Tainacan\Mappers_Handler::get_mapper_from_request($request) ) { $metadatum_mapper = $body['metadata_mappers'][0]; $metadatum = \Tainacan\Repositories\Repository::get_entity_by_post($metadatum_mapper['metadatum_id']); @@ -118,10 +118,10 @@ class REST_Metadatum_Mappers_Controller extends REST_Controller { * @return \WP_Error|\WP_REST_Response */ public function update_item( $request ) { - $Tainacan_Exposers = \Tainacan\Exposers\Exposers::get_instance(); + $Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance(); $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); $body = json_decode( $request->get_body(), true ); - if($mapper = $Tainacan_Exposers::request_has_mapper($request)) { + if($mapper = $Tainacan_Mappers::get_mapper_from_request($request)) { if(count($body['metadata_mappers']) > 0) { $response = []; $saved = []; diff --git a/src/api/tainacan-rest-creator.php b/src/api/tainacan-rest-creator.php index d70331e3b..546209d94 100644 --- a/src/api/tainacan-rest-creator.php +++ b/src/api/tainacan-rest-creator.php @@ -17,6 +17,7 @@ $rest_importers_controller = new \Tainacan\API\EndPoints\REST_Importers_Contr $rest_exporters_controller = new \Tainacan\API\EndPoints\REST_Exporters_Controller(); $rest_background_processes_controller = new \Tainacan\API\EndPoints\REST_Background_Processes_Controller(); $rest_bulkedit_controller = new \Tainacan\API\EndPoints\REST_Bulkedit_Controller(); +$rest_exposers_controller = new \Tainacan\API\EndPoints\REST_Exposers_Controller(); new \Tainacan\API\EndPoints\REST_Export_Controller(); new \Tainacan\API\EndPoints\REST_Metadatum_Mappers_Controller(); $rest_facets_controller = new \Tainacan\API\EndPoints\REST_Facets_Controller(); diff --git a/src/classes/entities/class-tainacan-item-metadata-entity.php b/src/classes/entities/class-tainacan-item-metadata-entity.php index 52679adc0..871073966 100644 --- a/src/classes/entities/class-tainacan-item-metadata-entity.php +++ b/src/classes/entities/class-tainacan-item-metadata-entity.php @@ -102,9 +102,9 @@ class Item_Metadata_Entity extends Entity { $total = sizeof($value); $count = 0; - $prefix = $item_metadata->get_multivalue_prefix(); - $suffix = $item_metadata->get_multivalue_suffix(); - $separator = $item_metadata->get_multivalue_separator(); + $prefix = $this->get_multivalue_prefix(); + $suffix = $this->get_multivalue_suffix(); + $separator = $this->get_multivalue_separator(); foreach ($value as $v) { diff --git a/src/classes/filter-types/checkbox/Checkbox.vue b/src/classes/filter-types/checkbox/Checkbox.vue index 27e39e2a1..723fd6021 100644 --- a/src/classes/filter-types/checkbox/Checkbox.vue +++ b/src/classes/filter-types/checkbox/Checkbox.vue @@ -1,6 +1,6 @@