Merge branch 'develop' into feature/794.
This commit is contained in:
commit
b5bc411dee
|
@ -23,8 +23,8 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
# Notes regarding supported versions in WP:
|
# Notes regarding supported versions in WP:
|
||||||
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
|
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
|
||||||
php: ['5.6', '7.0', '7.3', '7.4']
|
php: ['7.0', '7.3', '7.4']
|
||||||
wp: ['latest', '5.4']
|
wp: ['latest', '5.9']
|
||||||
experimental: [false]
|
experimental: [false]
|
||||||
|
|
||||||
# include:
|
# include:
|
||||||
|
@ -50,7 +50,7 @@ jobs:
|
||||||
# in combination with PHP < 7.4 is not properly/sufficiently supported
|
# in combination with PHP < 7.4 is not properly/sufficiently supported
|
||||||
# within WP Core.
|
# within WP Core.
|
||||||
# See: https://core.trac.wordpress.org/ticket/52496
|
# See: https://core.trac.wordpress.org/ticket/52496
|
||||||
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.4 || matrix.php < 7.4) && '5.7' ) || '8.0' }}
|
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.9 || matrix.php < 7.4) && '5.7' ) || '8.0' }}
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
## Contribution guidelines
|
|
||||||
|
|
||||||
Interested in contributing to Tainacan? That's awesome! :muscle: In this page, we'll talk about paths of contribution and what we consider a quality contribution.
|
|
||||||
|
|
||||||
### Our language policy
|
|
||||||
While Tainacan is a Brazilian project, we have adopted English as our primary language on development matters. Writing comments in Portuguese on [issues](https://github.com/tainacan/tainacan/issues) and [pull requests](https://github.com/tainacan/tainacan/pulls) is allowed as long as you provide an English translation of your comments. Writing comments in Portuguese on commits is expressively prohibited. Comments on the codebase and variable names should also be written in English only.
|
|
||||||
|
|
||||||
### Thinking about how you can contribute
|
|
||||||
|
|
||||||
Ask yourself the following questions: do you work, directly or indirectly, with cultural preservation? If yes, what do you do? If not, are you just a curious person just excited about it? What kind of skills do you have? Is there something you find fun to do you think you can shape as a contribution to Tainacan?
|
|
||||||
|
|
||||||
Free and open source projects offer a diversity of contributions options that go from direct involvement with the development of a software (submiting patches to eliminate a bug, implementing new features, creating new tests) to works related to localization (translating the software interface), design (creative works), user experience (testing new iterations of Tainacan and reporting issues), documentation (contributing to our wiki with new articles or improving existing ones) and communication (creating videos about Tainacan, giving talks mentioning it). Here, we'll talk about in particular about contributions to this repository.
|
|
||||||
|
|
||||||
### Issue system
|
|
||||||
An issue is a thread within the project's GitHub repository focused on debating bugs, feature requests or errors one may stumble upon. To gather as much information as possible and organize discussions to be clearer and more searchable, this repository has a few templates for the most common issues:
|
|
||||||
|
|
||||||
#### Bug report
|
|
||||||
If something is not working properly on Tainacan, use this template.
|
|
||||||
|
|
||||||
#### Feature request
|
|
||||||
If you have any feature ideas you would like to suggest to our developers, use this template.
|
|
||||||
|
|
||||||
A great issue is one that includes a concise description of errors you are stumbling upon along with crucial information such as which version of Tainacan you are using, which web browser, or which WordPress version. It's also important to search our repository for duplicates—and if you find one, opt to participate in the original discussion adding new information instead of creating your own. That will help contributors and users to keep track of a specific subject more easily.
|
|
|
@ -1 +0,0 @@
|
||||||
You can find all of Tainacan documentation in our Wiki: [https://wiki.tainacan.org](https://wiki.tainacan.org)
|
|
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1,291 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* File used to generate docs for the repositories classes
|
|
||||||
*
|
|
||||||
* change the line below to the path to the wp-config of a WP installation
|
|
||||||
*
|
|
||||||
* Dont forget to set the language of your WordPress to english
|
|
||||||
*/
|
|
||||||
//include('/path/to/wp-config.php');
|
|
||||||
|
|
||||||
$repos = [
|
|
||||||
|
|
||||||
'collections' => [
|
|
||||||
'instance' => \Tainacan\Repositories\Collections::get_instance(),
|
|
||||||
'methods' => [
|
|
||||||
[
|
|
||||||
'name' => 'fetch',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_one',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'insert',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'update',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'delete',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'trash',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'metadata' => [
|
|
||||||
'instance' => \Tainacan\Repositories\Metadata::get_instance(),
|
|
||||||
'methods' => [
|
|
||||||
[
|
|
||||||
'name' => 'fetch',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_one',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_ids',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_by_collection',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_ids_by_collection',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_metadata_types',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'get_core_metadata',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'get_core_title_metadatum',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'get_core_description_metadatum',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_all_metadatum_values',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'insert',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'update',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'delete',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'trash',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'filters' => [
|
|
||||||
'instance' => \Tainacan\Repositories\Filters::get_instance(),
|
|
||||||
'methods' => [
|
|
||||||
[
|
|
||||||
'name' => 'fetch',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_one',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_ids',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_by_collection',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_ids_by_collection',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'insert',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'update',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'delete',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'trash',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'items' => [
|
|
||||||
'instance' => \Tainacan\Repositories\Items::get_instance(),
|
|
||||||
'methods' => [
|
|
||||||
[
|
|
||||||
'name' => 'fetch',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_one',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_ids',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'get_thumbnail_id_from_document',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'insert',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'update',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'delete',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'trash',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'taxonomies' => [
|
|
||||||
'instance' => \Tainacan\Repositories\Taxonomies::get_instance(),
|
|
||||||
'methods' => [
|
|
||||||
[
|
|
||||||
'name' => 'fetch',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_one',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_by_collection',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'term_exists',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'insert',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'update',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'delete',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'trash',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'terms' => [
|
|
||||||
'instance' => \Tainacan\Repositories\Terms::get_instance(),
|
|
||||||
'methods' => [
|
|
||||||
[
|
|
||||||
'name' => 'fetch',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'fetch_one',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'insert',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'update',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'delete',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'trash',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
// 'item-metadata' => [
|
|
||||||
// 'instance' => \Tainacan\Repositories\Item_Metadata::get_instance(),
|
|
||||||
// 'methods' => [
|
|
||||||
// [
|
|
||||||
// 'name' => 'fetch',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'name' => 'get_value',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'name' => 'insert',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'name' => 'delete',
|
|
||||||
// ],
|
|
||||||
// [
|
|
||||||
// 'name' => 'trash',
|
|
||||||
// ]
|
|
||||||
// ]
|
|
||||||
// ],
|
|
||||||
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
function get_method_doc($repo, $method) {
|
|
||||||
|
|
||||||
//return '';
|
|
||||||
|
|
||||||
$r = new ReflectionMethod($repo, $method);
|
|
||||||
$doc = $r->getDocComment();
|
|
||||||
$doc = str_replace('/**', '', $doc);
|
|
||||||
$doc = str_replace('*/', '', $doc);
|
|
||||||
$doc = str_replace(' * ', '', $doc);
|
|
||||||
$doc = str_replace(' *', '', $doc);
|
|
||||||
$doc = preg_replace('/\t+/', '', $doc );
|
|
||||||
return $doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($repos as $name => $repo) {
|
|
||||||
$i = $repo['instance'];
|
|
||||||
$map = $i->get_map();
|
|
||||||
$entity = $i->entities_type;
|
|
||||||
$entity = strtolower( str_replace('\Tainacan\Entities\\', '', $entity) );
|
|
||||||
$target_file = 'repository-' . $name . '.md';
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
|
|
||||||
# <?= $i->get_name(); ?> Repository
|
|
||||||
|
|
||||||
## Main Methods
|
|
||||||
|
|
||||||
These are the most used methods of this repository. For a complete list see [the repository file](../src/classes/repositories/class-tainacan-<?= $name; ?>.php).
|
|
||||||
|
|
||||||
<?php foreach ($repo['methods'] as $method): ?>
|
|
||||||
|
|
||||||
### <?= $method['name']; ?>()
|
|
||||||
|
|
||||||
<?= get_method_doc(get_class($i), $method['name']); ?>
|
|
||||||
|
|
||||||
<?php endforeach; ?>
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```PHP
|
|
||||||
$repository = \Tainacan\Repositories\<?= $i->get_name(); ?>::get_instance();
|
|
||||||
```
|
|
||||||
|
|
||||||
## Entity Properties
|
|
||||||
|
|
||||||
These are the Entity attributes for this repository. The Entity class is at [classes/entities folder](../src/classes/entities/class-tainacan-<?= $entity; ?>.php)
|
|
||||||
|
|
||||||
Property | Description | Slug | Getter | Setter | Stored as
|
|
||||||
--- | --- | --- | --- | --- | ---
|
|
||||||
<?php foreach ($map as $s => $m): ?>
|
|
||||||
<?= $m['title']; ?>|<?= $m['description']; ?>|<?= $s; ?>|`$entity->get_<?= $s; ?>()`|`$entity->set_<?= $s; ?>()`|<?= $m['map'] . "\n"; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
|
|
||||||
### Entity usage
|
|
||||||
|
|
||||||
|
|
||||||
Create new
|
|
||||||
|
|
||||||
```PHP
|
|
||||||
$entity = new <?= $i->entities_type; ?>();
|
|
||||||
```
|
|
||||||
|
|
||||||
Get existing by ID
|
|
||||||
```PHP
|
|
||||||
$repository = \Tainacan\Repositories\<?= $i->get_name(); ?>::get_instance();
|
|
||||||
$entity = $repository->fetch(12);
|
|
||||||
echo 'My ID is ' . $entity->get_id(); // 12
|
|
||||||
```
|
|
||||||
|
|
||||||
<?php
|
|
||||||
file_put_contents($target_file, ob_get_clean());
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -1 +0,0 @@
|
||||||
This page was moved to https://tainacan.github.io/tainacan-wiki/
|
|
|
@ -32,7 +32,7 @@
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"sortablejs": "^1.15.0",
|
"sortablejs": "^1.15.0",
|
||||||
"sortablejs-vue3": "^1.2.9",
|
"sortablejs-vue3": "^1.2.9",
|
||||||
"swiper": "^8.4.5",
|
"swiper": "^8.4.7",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-countup-v3": "^1.3.0",
|
"vue-countup-v3": "^1.3.0",
|
||||||
"vue-router": "^4.2.4",
|
"vue-router": "^4.2.4",
|
||||||
|
|
|
@ -1,3 +1,211 @@
|
||||||
|
/**
|
||||||
|
* Swiper 8.4.7
|
||||||
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||||
|
* https://swiperjs.com
|
||||||
|
*
|
||||||
|
* Copyright 2014-2023 Vladimir Kharlampidi
|
||||||
|
*
|
||||||
|
* Released under the MIT License
|
||||||
|
*
|
||||||
|
* Released on: January 30, 2023
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: 'swiper-icons';
|
||||||
|
src: url("data:application/font-woff;charset=utf-8;base64, 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") format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal; }
|
||||||
|
:root {
|
||||||
|
--swiper-theme-color: #007aff; }
|
||||||
|
.swiper {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
/* Fix of Webkit flickering */
|
||||||
|
z-index: 1; }
|
||||||
|
|
||||||
|
.swiper-vertical > .swiper-wrapper {
|
||||||
|
flex-direction: column; }
|
||||||
|
|
||||||
|
.swiper-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
transition-property: transform;
|
||||||
|
box-sizing: content-box; }
|
||||||
|
|
||||||
|
.swiper-android .swiper-slide,
|
||||||
|
.swiper-wrapper {
|
||||||
|
transform: translate3d(0px, 0, 0); }
|
||||||
|
|
||||||
|
.swiper-pointer-events {
|
||||||
|
touch-action: pan-y; }
|
||||||
|
.swiper-pointer-events.swiper-vertical {
|
||||||
|
touch-action: pan-x; }
|
||||||
|
|
||||||
|
.swiper-slide {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
transition-property: transform; }
|
||||||
|
|
||||||
|
.swiper-slide-invisible-blank {
|
||||||
|
visibility: hidden; }
|
||||||
|
|
||||||
|
/* Auto Height */
|
||||||
|
.swiper-autoheight,
|
||||||
|
.swiper-autoheight .swiper-slide {
|
||||||
|
height: auto; }
|
||||||
|
.swiper-autoheight .swiper-wrapper {
|
||||||
|
align-items: flex-start;
|
||||||
|
transition-property: transform, height; }
|
||||||
|
|
||||||
|
.swiper-backface-hidden .swiper-slide {
|
||||||
|
transform: translateZ(0);
|
||||||
|
backface-visibility: hidden; }
|
||||||
|
|
||||||
|
/* 3D Effects */
|
||||||
|
.swiper-3d, .swiper-3d.swiper-css-mode .swiper-wrapper {
|
||||||
|
perspective: 1200px; }
|
||||||
|
.swiper-3d .swiper-wrapper,
|
||||||
|
.swiper-3d .swiper-slide,
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom,
|
||||||
|
.swiper-3d .swiper-cube-shadow {
|
||||||
|
transform-style: preserve-3d; }
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10; }
|
||||||
|
.swiper-3d .swiper-slide-shadow {
|
||||||
|
background: rgba(0, 0, 0, 0.15); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-left {
|
||||||
|
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-right {
|
||||||
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-top {
|
||||||
|
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
|
||||||
|
/* CSS Mode */
|
||||||
|
.swiper-css-mode > .swiper-wrapper {
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
/* For Firefox */
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
/* For Internet Explorer and Edge */ }
|
||||||
|
.swiper-css-mode > .swiper-wrapper::-webkit-scrollbar {
|
||||||
|
display: none; }
|
||||||
|
.swiper-css-mode > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: start start; }
|
||||||
|
|
||||||
|
.swiper-horizontal.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: x mandatory; }
|
||||||
|
|
||||||
|
.swiper-vertical.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: y mandatory; }
|
||||||
|
|
||||||
|
.swiper-centered > .swiper-wrapper::before {
|
||||||
|
content: '';
|
||||||
|
flex-shrink: 0;
|
||||||
|
order: 9999; }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-inline-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper::before {
|
||||||
|
height: 100%;
|
||||||
|
width: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-block-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper::before {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: center center;
|
||||||
|
scroll-snap-stop: always; }
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--swiper-navigation-size: 44px;
|
||||||
|
/*
|
||||||
|
--swiper-navigation-color: var(--swiper-theme-color);
|
||||||
|
*/ }
|
||||||
|
.swiper-button-prev, .swiper-button-next {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
width: calc(var(--swiper-navigation-size) / 44 * 27);
|
||||||
|
height: var(--swiper-navigation-size);
|
||||||
|
margin-top: calc(0px - (var(--swiper-navigation-size) / 2));
|
||||||
|
z-index: 10;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--swiper-navigation-color, var(--swiper-theme-color)); }
|
||||||
|
.swiper-button-prev.swiper-button-disabled,
|
||||||
|
.swiper-button-next.swiper-button-disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-button-prev.swiper-button-hidden,
|
||||||
|
.swiper-button-next.swiper-button-hidden {
|
||||||
|
opacity: 0;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-navigation-disabled .swiper-button-prev,
|
||||||
|
.swiper-navigation-disabled .swiper-button-next {
|
||||||
|
display: none !important; }
|
||||||
|
.swiper-button-prev:after, .swiper-button-next:after {
|
||||||
|
font-family: swiper-icons;
|
||||||
|
font-size: var(--swiper-navigation-size);
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0;
|
||||||
|
font-variant: initial;
|
||||||
|
line-height: 1; }
|
||||||
|
|
||||||
|
.swiper-button-prev,
|
||||||
|
.swiper-rtl .swiper-button-next {
|
||||||
|
left: 10px;
|
||||||
|
right: auto; }
|
||||||
|
.swiper-button-prev:after,
|
||||||
|
.swiper-rtl .swiper-button-next:after {
|
||||||
|
content: 'prev'; }
|
||||||
|
|
||||||
|
.swiper-button-next,
|
||||||
|
.swiper-rtl .swiper-button-prev {
|
||||||
|
right: 10px;
|
||||||
|
left: auto; }
|
||||||
|
.swiper-button-next:after,
|
||||||
|
.swiper-rtl .swiper-button-prev:after {
|
||||||
|
content: 'next'; }
|
||||||
|
|
||||||
|
.swiper-button-lock {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
|
/* a11y */
|
||||||
|
.swiper .swiper-notification {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1000; }
|
||||||
|
|
||||||
.components-panel__body .collection-carousel-view-modes {
|
.components-panel__body .collection-carousel-view-modes {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 12px 0 24px 0; }
|
margin: 12px 0 24px 0; }
|
||||||
|
@ -118,7 +326,7 @@
|
||||||
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper {
|
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper {
|
||||||
margin: 0 var(--spaceAroundCarousel, 50px); }
|
margin: 0 var(--spaceAroundCarousel, 50px); }
|
||||||
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper ul.swiper-wrapper {
|
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper ul.swiper-wrapper {
|
||||||
list-style: none;
|
list-style: none !important;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: auto; }
|
height: auto; }
|
||||||
|
@ -313,7 +521,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item:hover button:hover {
|
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,211 @@
|
||||||
|
/**
|
||||||
|
* Swiper 8.4.7
|
||||||
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||||
|
* https://swiperjs.com
|
||||||
|
*
|
||||||
|
* Copyright 2014-2023 Vladimir Kharlampidi
|
||||||
|
*
|
||||||
|
* Released under the MIT License
|
||||||
|
*
|
||||||
|
* Released on: January 30, 2023
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: 'swiper-icons';
|
||||||
|
src: url("data:application/font-woff;charset=utf-8;base64, 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") format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal; }
|
||||||
|
:root {
|
||||||
|
--swiper-theme-color: #007aff; }
|
||||||
|
.swiper {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
/* Fix of Webkit flickering */
|
||||||
|
z-index: 1; }
|
||||||
|
|
||||||
|
.swiper-vertical > .swiper-wrapper {
|
||||||
|
flex-direction: column; }
|
||||||
|
|
||||||
|
.swiper-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
transition-property: transform;
|
||||||
|
box-sizing: content-box; }
|
||||||
|
|
||||||
|
.swiper-android .swiper-slide,
|
||||||
|
.swiper-wrapper {
|
||||||
|
transform: translate3d(0px, 0, 0); }
|
||||||
|
|
||||||
|
.swiper-pointer-events {
|
||||||
|
touch-action: pan-y; }
|
||||||
|
.swiper-pointer-events.swiper-vertical {
|
||||||
|
touch-action: pan-x; }
|
||||||
|
|
||||||
|
.swiper-slide {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
transition-property: transform; }
|
||||||
|
|
||||||
|
.swiper-slide-invisible-blank {
|
||||||
|
visibility: hidden; }
|
||||||
|
|
||||||
|
/* Auto Height */
|
||||||
|
.swiper-autoheight,
|
||||||
|
.swiper-autoheight .swiper-slide {
|
||||||
|
height: auto; }
|
||||||
|
.swiper-autoheight .swiper-wrapper {
|
||||||
|
align-items: flex-start;
|
||||||
|
transition-property: transform, height; }
|
||||||
|
|
||||||
|
.swiper-backface-hidden .swiper-slide {
|
||||||
|
transform: translateZ(0);
|
||||||
|
backface-visibility: hidden; }
|
||||||
|
|
||||||
|
/* 3D Effects */
|
||||||
|
.swiper-3d, .swiper-3d.swiper-css-mode .swiper-wrapper {
|
||||||
|
perspective: 1200px; }
|
||||||
|
.swiper-3d .swiper-wrapper,
|
||||||
|
.swiper-3d .swiper-slide,
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom,
|
||||||
|
.swiper-3d .swiper-cube-shadow {
|
||||||
|
transform-style: preserve-3d; }
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10; }
|
||||||
|
.swiper-3d .swiper-slide-shadow {
|
||||||
|
background: rgba(0, 0, 0, 0.15); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-left {
|
||||||
|
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-right {
|
||||||
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-top {
|
||||||
|
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
|
||||||
|
/* CSS Mode */
|
||||||
|
.swiper-css-mode > .swiper-wrapper {
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
/* For Firefox */
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
/* For Internet Explorer and Edge */ }
|
||||||
|
.swiper-css-mode > .swiper-wrapper::-webkit-scrollbar {
|
||||||
|
display: none; }
|
||||||
|
.swiper-css-mode > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: start start; }
|
||||||
|
|
||||||
|
.swiper-horizontal.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: x mandatory; }
|
||||||
|
|
||||||
|
.swiper-vertical.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: y mandatory; }
|
||||||
|
|
||||||
|
.swiper-centered > .swiper-wrapper::before {
|
||||||
|
content: '';
|
||||||
|
flex-shrink: 0;
|
||||||
|
order: 9999; }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-inline-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper::before {
|
||||||
|
height: 100%;
|
||||||
|
width: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-block-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper::before {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: center center;
|
||||||
|
scroll-snap-stop: always; }
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--swiper-navigation-size: 44px;
|
||||||
|
/*
|
||||||
|
--swiper-navigation-color: var(--swiper-theme-color);
|
||||||
|
*/ }
|
||||||
|
.swiper-button-prev, .swiper-button-next {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
width: calc(var(--swiper-navigation-size) / 44 * 27);
|
||||||
|
height: var(--swiper-navigation-size);
|
||||||
|
margin-top: calc(0px - (var(--swiper-navigation-size) / 2));
|
||||||
|
z-index: 10;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--swiper-navigation-color, var(--swiper-theme-color)); }
|
||||||
|
.swiper-button-prev.swiper-button-disabled,
|
||||||
|
.swiper-button-next.swiper-button-disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-button-prev.swiper-button-hidden,
|
||||||
|
.swiper-button-next.swiper-button-hidden {
|
||||||
|
opacity: 0;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-navigation-disabled .swiper-button-prev,
|
||||||
|
.swiper-navigation-disabled .swiper-button-next {
|
||||||
|
display: none !important; }
|
||||||
|
.swiper-button-prev:after, .swiper-button-next:after {
|
||||||
|
font-family: swiper-icons;
|
||||||
|
font-size: var(--swiper-navigation-size);
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0;
|
||||||
|
font-variant: initial;
|
||||||
|
line-height: 1; }
|
||||||
|
|
||||||
|
.swiper-button-prev,
|
||||||
|
.swiper-rtl .swiper-button-next {
|
||||||
|
left: 10px;
|
||||||
|
right: auto; }
|
||||||
|
.swiper-button-prev:after,
|
||||||
|
.swiper-rtl .swiper-button-next:after {
|
||||||
|
content: 'prev'; }
|
||||||
|
|
||||||
|
.swiper-button-next,
|
||||||
|
.swiper-rtl .swiper-button-prev {
|
||||||
|
right: 10px;
|
||||||
|
left: auto; }
|
||||||
|
.swiper-button-next:after,
|
||||||
|
.swiper-rtl .swiper-button-prev:after {
|
||||||
|
content: 'next'; }
|
||||||
|
|
||||||
|
.swiper-button-lock {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
|
/* a11y */
|
||||||
|
.swiper .swiper-notification {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1000; }
|
||||||
|
|
||||||
.wp-block-tainacan-carousel-items-list {
|
.wp-block-tainacan-carousel-items-list {
|
||||||
margin: 2em auto;
|
margin: 2em auto;
|
||||||
--swiper-navigation-color: var(--tainacan-block-primary, $primary);
|
--swiper-navigation-color: var(--tainacan-block-primary, $primary);
|
||||||
|
@ -125,7 +333,7 @@
|
||||||
.wp-block-tainacan-carousel-items-list .tainacan-carousel .swiper {
|
.wp-block-tainacan-carousel-items-list .tainacan-carousel .swiper {
|
||||||
margin: 0 var(--spaceAroundCarousel, 50px); }
|
margin: 0 var(--spaceAroundCarousel, 50px); }
|
||||||
.wp-block-tainacan-carousel-items-list .tainacan-carousel .swiper ul.swiper-wrapper {
|
.wp-block-tainacan-carousel-items-list .tainacan-carousel .swiper ul.swiper-wrapper {
|
||||||
list-style: none;
|
list-style: none !important;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: auto; }
|
height: auto; }
|
||||||
|
@ -305,7 +513,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item:hover button:hover {
|
.wp-block-tainacan-carousel-items-list ul.items-list-edit li.item-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,211 @@
|
||||||
|
/**
|
||||||
|
* Swiper 8.4.7
|
||||||
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||||
|
* https://swiperjs.com
|
||||||
|
*
|
||||||
|
* Copyright 2014-2023 Vladimir Kharlampidi
|
||||||
|
*
|
||||||
|
* Released under the MIT License
|
||||||
|
*
|
||||||
|
* Released on: January 30, 2023
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: 'swiper-icons';
|
||||||
|
src: url("data:application/font-woff;charset=utf-8;base64, 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") format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal; }
|
||||||
|
:root {
|
||||||
|
--swiper-theme-color: #007aff; }
|
||||||
|
.swiper {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
/* Fix of Webkit flickering */
|
||||||
|
z-index: 1; }
|
||||||
|
|
||||||
|
.swiper-vertical > .swiper-wrapper {
|
||||||
|
flex-direction: column; }
|
||||||
|
|
||||||
|
.swiper-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
transition-property: transform;
|
||||||
|
box-sizing: content-box; }
|
||||||
|
|
||||||
|
.swiper-android .swiper-slide,
|
||||||
|
.swiper-wrapper {
|
||||||
|
transform: translate3d(0px, 0, 0); }
|
||||||
|
|
||||||
|
.swiper-pointer-events {
|
||||||
|
touch-action: pan-y; }
|
||||||
|
.swiper-pointer-events.swiper-vertical {
|
||||||
|
touch-action: pan-x; }
|
||||||
|
|
||||||
|
.swiper-slide {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
transition-property: transform; }
|
||||||
|
|
||||||
|
.swiper-slide-invisible-blank {
|
||||||
|
visibility: hidden; }
|
||||||
|
|
||||||
|
/* Auto Height */
|
||||||
|
.swiper-autoheight,
|
||||||
|
.swiper-autoheight .swiper-slide {
|
||||||
|
height: auto; }
|
||||||
|
.swiper-autoheight .swiper-wrapper {
|
||||||
|
align-items: flex-start;
|
||||||
|
transition-property: transform, height; }
|
||||||
|
|
||||||
|
.swiper-backface-hidden .swiper-slide {
|
||||||
|
transform: translateZ(0);
|
||||||
|
backface-visibility: hidden; }
|
||||||
|
|
||||||
|
/* 3D Effects */
|
||||||
|
.swiper-3d, .swiper-3d.swiper-css-mode .swiper-wrapper {
|
||||||
|
perspective: 1200px; }
|
||||||
|
.swiper-3d .swiper-wrapper,
|
||||||
|
.swiper-3d .swiper-slide,
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom,
|
||||||
|
.swiper-3d .swiper-cube-shadow {
|
||||||
|
transform-style: preserve-3d; }
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10; }
|
||||||
|
.swiper-3d .swiper-slide-shadow {
|
||||||
|
background: rgba(0, 0, 0, 0.15); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-left {
|
||||||
|
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-right {
|
||||||
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-top {
|
||||||
|
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
|
||||||
|
/* CSS Mode */
|
||||||
|
.swiper-css-mode > .swiper-wrapper {
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
/* For Firefox */
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
/* For Internet Explorer and Edge */ }
|
||||||
|
.swiper-css-mode > .swiper-wrapper::-webkit-scrollbar {
|
||||||
|
display: none; }
|
||||||
|
.swiper-css-mode > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: start start; }
|
||||||
|
|
||||||
|
.swiper-horizontal.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: x mandatory; }
|
||||||
|
|
||||||
|
.swiper-vertical.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: y mandatory; }
|
||||||
|
|
||||||
|
.swiper-centered > .swiper-wrapper::before {
|
||||||
|
content: '';
|
||||||
|
flex-shrink: 0;
|
||||||
|
order: 9999; }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-inline-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper::before {
|
||||||
|
height: 100%;
|
||||||
|
width: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-block-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper::before {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: center center;
|
||||||
|
scroll-snap-stop: always; }
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--swiper-navigation-size: 44px;
|
||||||
|
/*
|
||||||
|
--swiper-navigation-color: var(--swiper-theme-color);
|
||||||
|
*/ }
|
||||||
|
.swiper-button-prev, .swiper-button-next {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
width: calc(var(--swiper-navigation-size) / 44 * 27);
|
||||||
|
height: var(--swiper-navigation-size);
|
||||||
|
margin-top: calc(0px - (var(--swiper-navigation-size) / 2));
|
||||||
|
z-index: 10;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--swiper-navigation-color, var(--swiper-theme-color)); }
|
||||||
|
.swiper-button-prev.swiper-button-disabled,
|
||||||
|
.swiper-button-next.swiper-button-disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-button-prev.swiper-button-hidden,
|
||||||
|
.swiper-button-next.swiper-button-hidden {
|
||||||
|
opacity: 0;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-navigation-disabled .swiper-button-prev,
|
||||||
|
.swiper-navigation-disabled .swiper-button-next {
|
||||||
|
display: none !important; }
|
||||||
|
.swiper-button-prev:after, .swiper-button-next:after {
|
||||||
|
font-family: swiper-icons;
|
||||||
|
font-size: var(--swiper-navigation-size);
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0;
|
||||||
|
font-variant: initial;
|
||||||
|
line-height: 1; }
|
||||||
|
|
||||||
|
.swiper-button-prev,
|
||||||
|
.swiper-rtl .swiper-button-next {
|
||||||
|
left: 10px;
|
||||||
|
right: auto; }
|
||||||
|
.swiper-button-prev:after,
|
||||||
|
.swiper-rtl .swiper-button-next:after {
|
||||||
|
content: 'prev'; }
|
||||||
|
|
||||||
|
.swiper-button-next,
|
||||||
|
.swiper-rtl .swiper-button-prev {
|
||||||
|
right: 10px;
|
||||||
|
left: auto; }
|
||||||
|
.swiper-button-next:after,
|
||||||
|
.swiper-rtl .swiper-button-prev:after {
|
||||||
|
content: 'next'; }
|
||||||
|
|
||||||
|
.swiper-button-lock {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
|
/* a11y */
|
||||||
|
.swiper .swiper-notification {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1000; }
|
||||||
|
|
||||||
.components-panel__body .term-carousel-view-modes {
|
.components-panel__body .term-carousel-view-modes {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 12px 0 24px 0; }
|
margin: 12px 0 24px 0; }
|
||||||
|
@ -118,7 +326,7 @@
|
||||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper {
|
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper {
|
||||||
margin: 0 var(--spaceAroundCarousel, 50px); }
|
margin: 0 var(--spaceAroundCarousel, 50px); }
|
||||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper ul.swiper-wrapper {
|
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper ul.swiper-wrapper {
|
||||||
list-style: none;
|
list-style: none !important;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: auto; }
|
height: auto; }
|
||||||
|
@ -313,7 +521,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item:hover button:hover {
|
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -91,7 +91,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item:hover button:hover {
|
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"mappings": "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",
|
"mappings": "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",
|
||||||
"sources": ["../../views/gutenberg-blocks/blocks/collections-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
|
"sources": ["../../views/gutenberg-blocks/blocks/collections-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
|
||||||
"names": [],
|
"names": [],
|
||||||
"file": "tainacan-gutenberg-block-collections-list.css"
|
"file": "tainacan-gutenberg-block-collections-list.css"
|
||||||
|
|
|
@ -216,7 +216,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-dynamic-items-list ul.items-list-edit li.item-list-item:hover button:hover {
|
.wp-block-tainacan-dynamic-items-list ul.items-list-edit li.item-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -207,7 +207,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-facets-list ul.facets-list-edit li.facet-list-item:hover button:hover {
|
.wp-block-tainacan-facets-list ul.facets-list-edit li.facet-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,211 @@
|
||||||
|
/**
|
||||||
|
* Swiper 8.4.7
|
||||||
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
||||||
|
* https://swiperjs.com
|
||||||
|
*
|
||||||
|
* Copyright 2014-2023 Vladimir Kharlampidi
|
||||||
|
*
|
||||||
|
* Released under the MIT License
|
||||||
|
*
|
||||||
|
* Released on: January 30, 2023
|
||||||
|
*/
|
||||||
|
@font-face {
|
||||||
|
font-family: 'swiper-icons';
|
||||||
|
src: url("data:application/font-woff;charset=utf-8;base64, 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") format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal; }
|
||||||
|
:root {
|
||||||
|
--swiper-theme-color: #007aff; }
|
||||||
|
.swiper {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
/* Fix of Webkit flickering */
|
||||||
|
z-index: 1; }
|
||||||
|
|
||||||
|
.swiper-vertical > .swiper-wrapper {
|
||||||
|
flex-direction: column; }
|
||||||
|
|
||||||
|
.swiper-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
transition-property: transform;
|
||||||
|
box-sizing: content-box; }
|
||||||
|
|
||||||
|
.swiper-android .swiper-slide,
|
||||||
|
.swiper-wrapper {
|
||||||
|
transform: translate3d(0px, 0, 0); }
|
||||||
|
|
||||||
|
.swiper-pointer-events {
|
||||||
|
touch-action: pan-y; }
|
||||||
|
.swiper-pointer-events.swiper-vertical {
|
||||||
|
touch-action: pan-x; }
|
||||||
|
|
||||||
|
.swiper-slide {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
transition-property: transform; }
|
||||||
|
|
||||||
|
.swiper-slide-invisible-blank {
|
||||||
|
visibility: hidden; }
|
||||||
|
|
||||||
|
/* Auto Height */
|
||||||
|
.swiper-autoheight,
|
||||||
|
.swiper-autoheight .swiper-slide {
|
||||||
|
height: auto; }
|
||||||
|
.swiper-autoheight .swiper-wrapper {
|
||||||
|
align-items: flex-start;
|
||||||
|
transition-property: transform, height; }
|
||||||
|
|
||||||
|
.swiper-backface-hidden .swiper-slide {
|
||||||
|
transform: translateZ(0);
|
||||||
|
backface-visibility: hidden; }
|
||||||
|
|
||||||
|
/* 3D Effects */
|
||||||
|
.swiper-3d, .swiper-3d.swiper-css-mode .swiper-wrapper {
|
||||||
|
perspective: 1200px; }
|
||||||
|
.swiper-3d .swiper-wrapper,
|
||||||
|
.swiper-3d .swiper-slide,
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom,
|
||||||
|
.swiper-3d .swiper-cube-shadow {
|
||||||
|
transform-style: preserve-3d; }
|
||||||
|
.swiper-3d .swiper-slide-shadow,
|
||||||
|
.swiper-3d .swiper-slide-shadow-left,
|
||||||
|
.swiper-3d .swiper-slide-shadow-right,
|
||||||
|
.swiper-3d .swiper-slide-shadow-top,
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10; }
|
||||||
|
.swiper-3d .swiper-slide-shadow {
|
||||||
|
background: rgba(0, 0, 0, 0.15); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-left {
|
||||||
|
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-right {
|
||||||
|
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-top {
|
||||||
|
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
.swiper-3d .swiper-slide-shadow-bottom {
|
||||||
|
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); }
|
||||||
|
|
||||||
|
/* CSS Mode */
|
||||||
|
.swiper-css-mode > .swiper-wrapper {
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
/* For Firefox */
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
/* For Internet Explorer and Edge */ }
|
||||||
|
.swiper-css-mode > .swiper-wrapper::-webkit-scrollbar {
|
||||||
|
display: none; }
|
||||||
|
.swiper-css-mode > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: start start; }
|
||||||
|
|
||||||
|
.swiper-horizontal.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: x mandatory; }
|
||||||
|
|
||||||
|
.swiper-vertical.swiper-css-mode > .swiper-wrapper {
|
||||||
|
scroll-snap-type: y mandatory; }
|
||||||
|
|
||||||
|
.swiper-centered > .swiper-wrapper::before {
|
||||||
|
content: '';
|
||||||
|
flex-shrink: 0;
|
||||||
|
order: 9999; }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-inline-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-horizontal > .swiper-wrapper::before {
|
||||||
|
height: 100%;
|
||||||
|
width: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {
|
||||||
|
margin-block-start: var(--swiper-centered-offset-before); }
|
||||||
|
.swiper-centered.swiper-vertical > .swiper-wrapper::before {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--swiper-centered-offset-after); }
|
||||||
|
.swiper-centered > .swiper-wrapper > .swiper-slide {
|
||||||
|
scroll-snap-align: center center;
|
||||||
|
scroll-snap-stop: always; }
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--swiper-navigation-size: 44px;
|
||||||
|
/*
|
||||||
|
--swiper-navigation-color: var(--swiper-theme-color);
|
||||||
|
*/ }
|
||||||
|
.swiper-button-prev, .swiper-button-next {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
width: calc(var(--swiper-navigation-size) / 44 * 27);
|
||||||
|
height: var(--swiper-navigation-size);
|
||||||
|
margin-top: calc(0px - (var(--swiper-navigation-size) / 2));
|
||||||
|
z-index: 10;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--swiper-navigation-color, var(--swiper-theme-color)); }
|
||||||
|
.swiper-button-prev.swiper-button-disabled,
|
||||||
|
.swiper-button-next.swiper-button-disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-button-prev.swiper-button-hidden,
|
||||||
|
.swiper-button-next.swiper-button-hidden {
|
||||||
|
opacity: 0;
|
||||||
|
cursor: auto;
|
||||||
|
pointer-events: none; }
|
||||||
|
.swiper-navigation-disabled .swiper-button-prev,
|
||||||
|
.swiper-navigation-disabled .swiper-button-next {
|
||||||
|
display: none !important; }
|
||||||
|
.swiper-button-prev:after, .swiper-button-next:after {
|
||||||
|
font-family: swiper-icons;
|
||||||
|
font-size: var(--swiper-navigation-size);
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0;
|
||||||
|
font-variant: initial;
|
||||||
|
line-height: 1; }
|
||||||
|
|
||||||
|
.swiper-button-prev,
|
||||||
|
.swiper-rtl .swiper-button-next {
|
||||||
|
left: 10px;
|
||||||
|
right: auto; }
|
||||||
|
.swiper-button-prev:after,
|
||||||
|
.swiper-rtl .swiper-button-next:after {
|
||||||
|
content: 'prev'; }
|
||||||
|
|
||||||
|
.swiper-button-next,
|
||||||
|
.swiper-rtl .swiper-button-prev {
|
||||||
|
right: 10px;
|
||||||
|
left: auto; }
|
||||||
|
.swiper-button-next:after,
|
||||||
|
.swiper-rtl .swiper-button-prev:after {
|
||||||
|
content: 'next'; }
|
||||||
|
|
||||||
|
.swiper-button-lock {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
|
/* a11y */
|
||||||
|
.swiper .swiper-notification {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: -1000; }
|
||||||
|
|
||||||
.item-gallery-edit-container .tainacan-media-component .swiper-slide,
|
.item-gallery-edit-container .tainacan-media-component .swiper-slide,
|
||||||
.item-gallery-edit-container .tainacan-media-component .swiper-button-prev,
|
.item-gallery-edit-container .tainacan-media-component .swiper-button-prev,
|
||||||
.item-gallery-edit-container .tainacan-media-component .swiper-button-next {
|
.item-gallery-edit-container .tainacan-media-component .swiper-button-next {
|
||||||
|
@ -85,7 +293,7 @@
|
||||||
fill: currentColor; }
|
fill: currentColor; }
|
||||||
.tainacan-media-component__swiper-main ul.swiper-wrapper,
|
.tainacan-media-component__swiper-main ul.swiper-wrapper,
|
||||||
.tainacan-media-component__swiper-thumbs ul.swiper-wrapper {
|
.tainacan-media-component__swiper-thumbs ul.swiper-wrapper {
|
||||||
list-style: none;
|
list-style: none !important;
|
||||||
padding: 0; }
|
padding: 0; }
|
||||||
|
|
||||||
.tainacan-media-component__swiper-main {
|
.tainacan-media-component__swiper-main {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,7 +95,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item:hover button:hover {
|
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"mappings": "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",
|
"mappings": "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",
|
||||||
"sources": ["../../views/gutenberg-blocks/blocks/items-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
|
"sources": ["../../views/gutenberg-blocks/blocks/items-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
|
||||||
"names": [],
|
"names": [],
|
||||||
"file": "tainacan-gutenberg-block-items-list.css"
|
"file": "tainacan-gutenberg-block-items-list.css"
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||||
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button:hover {
|
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button:hover {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"mappings": "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",
|
"mappings": "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",
|
||||||
"sources": ["../../views/gutenberg-blocks/blocks/terms-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
|
"sources": ["../../views/gutenberg-blocks/blocks/terms-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
|
||||||
"names": [],
|
"names": [],
|
||||||
"file": "tainacan-gutenberg-block-terms-list.css"
|
"file": "tainacan-gutenberg-block-terms-list.css"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Tainacan\API;
|
namespace Tainacan\API;
|
||||||
|
|
||||||
class REST_Controller extends \WP_REST_Controller {
|
abstract class REST_Controller extends \WP_REST_Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Controller constructor.
|
* REST_Controller constructor.
|
||||||
|
@ -627,6 +627,9 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
'description' => $value['description'],
|
'description' => $value['description'],
|
||||||
'type' => $value['type']
|
'type' => $value['type']
|
||||||
];
|
];
|
||||||
|
if( isset($value['items'])) {
|
||||||
|
$schema[$mapped]['items'] = $value['items'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
@ -662,4 +665,17 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract function get_schema();
|
||||||
|
|
||||||
|
function get_list_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => $this->get_schema(),
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'tags' => [$this->rest_base],
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
||||||
private $collections_repository;
|
private $collections_repository;
|
||||||
private $collection;
|
private $collection;
|
||||||
|
|
||||||
|
protected function get_schema() {
|
||||||
|
return "TODO:get_schema";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Background_Processes_Controller constructor.
|
* REST_Background_Processes_Controller constructor.
|
||||||
* Define the namespace, rest base and instantiate your attributes.
|
* Define the namespace, rest base and instantiate your attributes.
|
||||||
|
|
|
@ -8,6 +8,9 @@ use Tainacan\Repositories;
|
||||||
use Tainacan\Entities\Entity;
|
use Tainacan\Entities\Entity;
|
||||||
|
|
||||||
class REST_Bulkedit_Controller extends REST_Controller {
|
class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
|
private $metadatum_repository;
|
||||||
|
private $collections_repository;
|
||||||
|
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->rest_base = 'bulk-edit';
|
$this->rest_base = 'bulk-edit';
|
||||||
|
@ -34,6 +37,7 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => $this->get_create_params()
|
'args' => $this->get_create_params()
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_bulk_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)',
|
||||||
|
@ -42,7 +46,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
|
'args' => $this->get_actions_params()
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_bulk_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/add',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/add',
|
||||||
|
@ -51,17 +57,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'add_value'),
|
'callback' => array($this, 'add_value'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('add')
|
||||||
'metadatum_id' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __( 'The metadatum ID', 'tainacan' ),
|
|
||||||
],
|
|
||||||
'value' => [
|
|
||||||
'type' => ['string', 'integer'],
|
|
||||||
'description' => __( 'The value to be added', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/trash',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/trash',
|
||||||
|
@ -70,7 +68,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'trash_items'),
|
'callback' => array($this, 'trash_items'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
|
'args' => $this->get_actions_params('trash')
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/untrash',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/untrash',
|
||||||
|
@ -79,7 +79,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'untrash_items'),
|
'callback' => array($this, 'untrash_items'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
|
'args' => $this->get_actions_params('untrash')
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/delete_items',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/delete_items',
|
||||||
|
@ -88,7 +90,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'delete_items'),
|
'callback' => array($this, 'delete_items'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
|
'args' => $this->get_actions_params('delete_items')
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set_status',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set_status',
|
||||||
|
@ -97,13 +101,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'set_status'),
|
'callback' => array($this, 'set_status'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('set_status')
|
||||||
'value' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'description' => __( 'The new status value', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set',
|
||||||
|
@ -112,17 +112,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'set_value'),
|
'callback' => array($this, 'set_value'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('set')
|
||||||
'metadatum_id' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __( 'The metadatum ID', 'tainacan' ),
|
|
||||||
],
|
|
||||||
'value' => [
|
|
||||||
'type' => ['string', 'integer', 'array'],
|
|
||||||
'description' => __( 'The value to be set', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/copy_value',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/copy_value',
|
||||||
|
@ -131,17 +123,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'copy_value'),
|
'callback' => array($this, 'copy_value'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('copy_value')
|
||||||
'metadatum_id_to' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __( 'The metadatum ID', 'tainacan' ),
|
|
||||||
],
|
|
||||||
'metadatum_id_from' => [
|
|
||||||
'type' => ['string', 'integer'],
|
|
||||||
'description' => __( 'The metadatum ID to be copied', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/remove',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/remove',
|
||||||
|
@ -150,17 +134,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'remove_value'),
|
'callback' => array($this, 'remove_value'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('remove')
|
||||||
'metadatum_id' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __( 'The metadatum ID', 'tainacan' ),
|
|
||||||
],
|
|
||||||
'value' => [
|
|
||||||
'type' => ['string', 'integer'],
|
|
||||||
'description' => __( 'The value to be added', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/replace',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/replace',
|
||||||
|
@ -169,21 +145,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'replace_value'),
|
'callback' => array($this, 'replace_value'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('replace')
|
||||||
'metadatum_id' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __( 'The metadatum ID', 'tainacan' ),
|
|
||||||
],
|
|
||||||
'old_value' => [
|
|
||||||
'type' => ['string', 'integer'],
|
|
||||||
'description' => __( 'The value to search for', 'tainacan' ),
|
|
||||||
],
|
|
||||||
'new_value' => [
|
|
||||||
'type' => ['string', 'integer'],
|
|
||||||
'description' => __( 'The value to be set', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/clear',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/clear',
|
||||||
|
@ -192,13 +156,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'clear_value'),
|
'callback' => array($this, 'clear_value'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('clear')
|
||||||
'metadatum_id' => [
|
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __( 'The metadatum ID', 'tainacan' ),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set_comment_status',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set_comment_status',
|
||||||
|
@ -207,13 +167,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'set_comment_status'),
|
'callback' => array($this, 'set_comment_status'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_actions_params('set_comment_status')
|
||||||
'value' => [
|
|
||||||
'type' => 'string',
|
|
||||||
'description' => __( 'The new comments status (open or closed)', 'tainacan' ),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_actions_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/sequence/(?P<sequence_index>[\d]+)',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/sequence/(?P<sequence_index>[\d]+)',
|
||||||
|
@ -222,7 +178,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item_in_sequence'),
|
'callback' => array($this, 'get_item_in_sequence'),
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
|
'args' => $this->get_sequence_params()
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_sequence_schema')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -433,6 +391,11 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'description' => __( 'Array of items IDs', 'tainacan' ),
|
'description' => __( 'Array of items IDs', 'tainacan' ),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$query_params['collection_id'] = [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
|
||||||
$query_params['use_query'] = [
|
$query_params['use_query'] = [
|
||||||
'type' => ['boolean', 'object'],
|
'type' => ['boolean', 'object'],
|
||||||
'description' => __( 'Whether to use the current query to select posts', 'tainacan' ),
|
'description' => __( 'Whether to use the current query to select posts', 'tainacan' ),
|
||||||
|
@ -446,6 +409,217 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
return $query_params;
|
return $query_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function get_sequence_params() {
|
||||||
|
$endpoint_args = [
|
||||||
|
'collection_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'group_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Group ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'sequence_index' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Sequence index', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
?>
|
return $endpoint_args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function get_actions_params( $action = null ) {
|
||||||
|
$endpoint_args = [
|
||||||
|
'collection_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'group_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Group ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
switch ( $action ) {
|
||||||
|
case 'add':
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The metadatum ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
$endpoint_args['value'] = [
|
||||||
|
'type' => ['string', 'integer'],
|
||||||
|
'description' => __( 'The value to be added', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'set_status':
|
||||||
|
$endpoint_args['value'] = [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The new status value', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'set':
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The metadatum ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
$endpoint_args['value'] = [
|
||||||
|
'type' => ['string', 'integer', 'array'],
|
||||||
|
'description' => __( 'The value to be set', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'copy_value':
|
||||||
|
$endpoint_args['metadatum_id_to'] = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The metadatum ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
$endpoint_args['metadatum_id_from'] = [
|
||||||
|
'type' => ['string', 'integer'],
|
||||||
|
'description' => __( 'The metadatum ID to be copied', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'remove':
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The metadatum ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
$endpoint_args['value'] = [
|
||||||
|
'type' => ['string', 'integer'],
|
||||||
|
'description' => __( 'The value to be added', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'replace':
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The metadatum ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
$endpoint_args['old_value'] = [
|
||||||
|
'type' => ['string', 'integer'],
|
||||||
|
'description' => __( 'The value to search for', 'tainacan' ),
|
||||||
|
];
|
||||||
|
$endpoint_args['new_value'] = [
|
||||||
|
'type' => ['string', 'integer'],
|
||||||
|
'description' => __( 'The value to be set', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'clear':
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The metadatum ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 'set_comment_status':
|
||||||
|
$endpoint_args['value'] = [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The new comments status (open or closed)', 'tainacan' ),
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $endpoint_args;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_actions_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-action";
|
||||||
|
$schema['properties'] = [
|
||||||
|
'bg_process_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Bulk edition processs ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'method' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Method that was executed', 'tainacan' )
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_bulk_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-bulk";
|
||||||
|
$schema['properties'] = [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Bulk edition processs ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Bulk edition options containing the selection of items.', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'items_ids' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'Items selected for the bulk edition.', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'collection_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'order' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Order of the items selected', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'order_by' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'By which metadata the selected items are sorted', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'query' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Query used to select the items if not selected manually', 'tainacan' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sequence_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-sequence";
|
||||||
|
$schema['tags'][] = 'sequence-edit';
|
||||||
|
$schema['properties'] = [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Bulk edition processs ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'items_count' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items selected for the sequence edit.', 'tainacan' ),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Tainacan\Entities\Collection;
|
||||||
class REST_Collections_Controller extends REST_Controller {
|
class REST_Collections_Controller extends REST_Controller {
|
||||||
private $collections_repository;
|
private $collections_repository;
|
||||||
private $collection;
|
private $collection;
|
||||||
|
private $items_repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Collections_Controller constructor.
|
* REST_Collections_Controller constructor.
|
||||||
|
@ -52,15 +53,19 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_list_schema'],
|
||||||
));
|
));
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<collection_id>[\d]+)', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<collection_id>[\d]+)', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => [
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
],
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
|
@ -73,6 +78,10 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => array(
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
'permanently' => array(
|
'permanently' => array(
|
||||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||||
'default' => '0',
|
'default' => '0',
|
||||||
|
@ -87,11 +96,11 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_metadata_section_order'),
|
'callback' => array($this, 'update_metadata_section_order'),
|
||||||
'permission_callback' => array($this, 'update_metadata_section_order_permissions_check'),
|
'permission_callback' => array($this, 'update_metadata_section_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'metadata_section_order' => [
|
'collection_id' => [
|
||||||
'description' => __( 'The order of the metadata section in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_metadata_section_order']
|
],
|
||||||
]
|
'metadata_section_order' => $this->get_endpoint_arg_for_schema('metadata_section_order', ['required' => true])
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -102,11 +111,10 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_metadata_order'),
|
'callback' => array($this, 'update_metadata_order'),
|
||||||
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'metadata_order' => [
|
'metadata_order' => $this->get_endpoint_arg_for_schema('metadata_order', [
|
||||||
'description' => __( 'The order of the metadata in the section, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
||||||
]
|
])
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -117,11 +125,10 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_metadata_order'),
|
'callback' => array($this, 'update_metadata_order'),
|
||||||
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'metadata_order' => [
|
'metadata_order' => $this->get_endpoint_arg_for_schema('metadata_order', [
|
||||||
'description' => __( 'The order of the metadata in the section, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
||||||
]
|
])
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -132,11 +139,10 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_filters_order'),
|
'callback' => array($this, 'update_filters_order'),
|
||||||
'permission_callback' => array($this, 'update_filters_order_permissions_check'),
|
'permission_callback' => array($this, 'update_filters_order_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'filters_order' => [
|
'filters_order' => $this->get_endpoint_arg_for_schema('filters_order', [
|
||||||
'description' => __( 'The order of the filters in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
|
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
'validate_callback' => [$this, 'validate_filters_metadata_order']
|
||||||
]
|
])
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
|
@ -853,43 +859,64 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
|
||||||
|
|
||||||
$endpoint_args['name'] = array(
|
switch ( $method ) {
|
||||||
'description' => __('Limits the result set to collections with a specific name'),
|
case \WP_REST_Server::READABLE:
|
||||||
'type' => 'string',
|
$endpoint_args['name'] = array(
|
||||||
);
|
'description' => __('Limits the result set to collections with a specific name'),
|
||||||
|
'type' => 'string',
|
||||||
|
);
|
||||||
|
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params(),
|
||||||
|
parent::get_fetch_only_param(),
|
||||||
|
parent::get_meta_queries_params()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$map = $this->collections_repository->get_map();
|
||||||
|
|
||||||
$endpoint_args = array_merge(
|
foreach ($map as $mapped => $value){
|
||||||
$endpoint_args,
|
$set_ = 'set_'. $mapped;
|
||||||
parent::get_wp_query_params(),
|
|
||||||
parent::get_fetch_only_param(),
|
|
||||||
parent::get_meta_queries_params()
|
|
||||||
);
|
|
||||||
|
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
// Show only args that has a method set
|
||||||
$map = $this->collections_repository->get_map();
|
if( !method_exists($this->collection, "$set_") ){
|
||||||
|
unset($map[$mapped]);
|
||||||
foreach ($map as $mapped => $value){
|
}
|
||||||
$set_ = 'set_'. $mapped;
|
|
||||||
|
|
||||||
// Show only args that has a method set
|
|
||||||
if( !method_exists($this->collection, "$set_") ){
|
|
||||||
unset($map[$mapped]);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$endpoint_args = $map;
|
$endpoint_args = $map;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_endpoint_arg_for_schema($name, $properties = [], $repository = null) {
|
||||||
|
if ( $repository == null)
|
||||||
|
$repository = $this->collections_repository;
|
||||||
|
|
||||||
|
if ( !isset( $repository ) ) {
|
||||||
|
return ['title' => $name, 'description' => $name, 'type' => 'string'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = $repository->get_map();
|
||||||
|
if( !isset( $map[$name] ) ) {
|
||||||
|
return ['title' => $name, 'description' => $name, 'type' => 'string'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$arg = array_merge($map[$name], $properties);
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
|
||||||
function get_schema() {
|
function get_schema() {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'collection',
|
'title' => 'collection',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->collections_repository );
|
$main_schema = parent::get_repository_schema( $this->collections_repository );
|
||||||
|
@ -902,8 +929,8 @@ class REST_Collections_Controller extends REST_Controller {
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -12,6 +12,7 @@ use \Tainacan\Exposers\Mappers\Value;
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
class REST_Exporters_Controller extends REST_Controller {
|
class REST_Exporters_Controller extends REST_Controller {
|
||||||
|
private $collections_repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Exporters_Controller constructor.
|
* REST_Exporters_Controller constructor.
|
||||||
|
@ -40,6 +41,7 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'get_registered_exporters'),
|
'callback' => array($this, 'get_registered_exporters'),
|
||||||
'permission_callback' => array($this, 'export_permissions_check'),
|
'permission_callback' => array($this, 'export_permissions_check'),
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema_exporters_available']
|
||||||
));
|
));
|
||||||
|
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/session', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/session', array(
|
||||||
|
@ -48,12 +50,13 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'create_item'),
|
'callback' => array($this, 'create_item'),
|
||||||
'permission_callback' => array($this, 'export_permissions_check'),
|
'permission_callback' => array($this, 'export_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
'importer_slug' => [
|
'exporter_slug' => [
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The slug of the exporter to be initialized', 'tainacan' ),
|
'description' => __( 'The slug of the exporter to be initialized', 'tainacan' ),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
|
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/session/(?P<session_id>[0-9a-f]+)', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/session/(?P<session_id>[0-9a-f]+)', array(
|
||||||
|
@ -62,6 +65,10 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'update_item'),
|
'callback' => array($this, 'update_item'),
|
||||||
'permission_callback' => array($this, 'export_permissions_check'),
|
'permission_callback' => array($this, 'export_permissions_check'),
|
||||||
'args' => [
|
'args' => [
|
||||||
|
'session_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The ID for this exporter session', 'tainacan' ),
|
||||||
|
],
|
||||||
'send_email' => [
|
'send_email' => [
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The e-mail to be used by the export to send a message when the process ends', 'tainacan' ),
|
'description' => __( 'The e-mail to be used by the export to send a message when the process ends', 'tainacan' ),
|
||||||
|
@ -76,6 +83,7 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
|
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/session/(?P<session_id>[0-9a-f]+)/run', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/session/(?P<session_id>[0-9a-f]+)/run', array(
|
||||||
|
@ -83,7 +91,14 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'run'),
|
'callback' => array($this, 'run'),
|
||||||
'permission_callback' => array($this, 'export_permissions_check'),
|
'permission_callback' => array($this, 'export_permissions_check'),
|
||||||
|
'args' => [
|
||||||
|
'session_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The ID for this exporter session', 'tainacan' ),
|
||||||
|
],
|
||||||
|
]
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema_run']
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -264,6 +279,215 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_schema() {
|
||||||
|
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'exporters',
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ 'background-process' ],
|
||||||
|
];
|
||||||
|
|
||||||
|
$schema['properties'] = array_merge(
|
||||||
|
[
|
||||||
|
'id' => [
|
||||||
|
'description' => esc_html__( 'The ID for this exporter session', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'in_step_count' => [
|
||||||
|
'description' => esc_html__( 'Number of items found to process in step.', 'tainacan' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'current_step' => [
|
||||||
|
'description' => esc_html__( 'Current step.', 'tainacan' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'transients' => [
|
||||||
|
'description' => esc_html__( 'Properties of exporter class, the values will be kept during all the time the process is running.', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'description' => esc_html__( 'the set set of options exporter may have its own, that will be used during the export process.', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'options_form' => [
|
||||||
|
'description' => esc_html__( 'The form to input the set set of options exporter may have its own.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'collections' => [
|
||||||
|
'description' => esc_html__( 'Array of the target collections, with their IDs, an identifier from the source, the total number of items to be exporter, the mapping array from the source structure to the ID of the metadata in tainacan', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Collection ID an identifier from the source', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total_items' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'The total number of items to be exporter', 'tainacan' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'class_name' => [
|
||||||
|
'description' => esc_html__( 'The Exporter Class. e.g. "\Tainacan\Exporter\Test_Exporter"', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'manual_collection' => [
|
||||||
|
'description' => esc_html__( 'Define whether manually selecting collections is accepted', 'tainacan' ),
|
||||||
|
'type' => 'boolean',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'mapping_accept' => [
|
||||||
|
'description' => esc_html__( 'If is set to “any”, all mappers will be available. If set to “list”, only the list of mappers indicated by "mapping_list" can be used.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'mapping_list' => [
|
||||||
|
'description' => esc_html__( 'The list of mappers accepted by the exported.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'accept_no_mapping' => [
|
||||||
|
'description' => esc_html__( 'Informs that is also allow export items in their original form, without any mapping.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'mapping_selected' => [
|
||||||
|
'description' => esc_html__( 'Mapper selected for process.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'current_collection_item' => [
|
||||||
|
'description' => esc_html__( 'Id of the current item in the process is running on.', 'tainacan' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'current_collection' => [
|
||||||
|
'description' => esc_html__( 'Id of the current collection in the process is running on.', 'tainacan' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'output_files' => [
|
||||||
|
'description' => esc_html__( 'Get a list of the generated files to display to users.', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'send_email' => [
|
||||||
|
'description' => esc_html__( 'if notify the user after completion of the process.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_schema_run() {
|
||||||
|
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'exporters-run',
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ 'background-process' ],
|
||||||
|
];
|
||||||
|
|
||||||
|
$schema['properties'] = array_merge(
|
||||||
|
[
|
||||||
|
'bg_process_id' => [
|
||||||
|
'description' => esc_html__( 'The ID for this exporter session', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_schema_exporters_available() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'exporters-available',
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ 'background-process' ],
|
||||||
|
];
|
||||||
|
|
||||||
|
$schema['properties'] = array_merge(
|
||||||
|
[
|
||||||
|
'slug' => [
|
||||||
|
'description' => esc_html__( 'A unique slug for the exporter. e.g. "example-exporter"', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'description' => esc_html__( 'The name of the exporter. e.g. "Example exporter".', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'description' => esc_html__( 'The exporter description', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'class_name' => [
|
||||||
|
'description' => esc_html__( 'The Exporter Class. e.g. "\Tainacan\Exporter\Test_Exporter"', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'manual_mapping' => [
|
||||||
|
'description' => esc_html__( 'Wether Tainacan must present the user with an interface to manually choose a mapping standard. This will allow them to export the items mapped to a chosen standard instead of in its original form.', 'tainacan' ),
|
||||||
|
'type' => 'boolean',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
],
|
||||||
|
'manual_collection' => [
|
||||||
|
'description' => esc_html__( 'Wether Tainacan will let the user choose the source collection. If set to true, Tainacan give the user a select box from where he/she will Choose one (and only one) Collection to export items from. Otherwise, the child exporter class must choose the collections somehow.', 'tainacan' ),
|
||||||
|
'type' => 'boolean',
|
||||||
|
'context' => array( 'view' ),
|
||||||
|
'readonly' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,14 @@ use Tainacan\Mappers_Handler;
|
||||||
use \Tainacan\API\REST_Controller;
|
use \Tainacan\API\REST_Controller;
|
||||||
|
|
||||||
class REST_Exposers_Controller extends REST_Controller {
|
class REST_Exposers_Controller extends REST_Controller {
|
||||||
|
|
||||||
|
|
||||||
private $metadatum_repository;
|
private $metadatum_repository;
|
||||||
|
private $exposers;
|
||||||
|
private $mappers;
|
||||||
|
|
||||||
|
protected function get_schema() {
|
||||||
|
return "TODO:get_schema";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Facets_Controller constructor.
|
* REST_Facets_Controller constructor.
|
||||||
|
|
|
@ -7,8 +7,6 @@ use Tainacan\Entities;
|
||||||
use \Tainacan\API\REST_Controller;
|
use \Tainacan\API\REST_Controller;
|
||||||
|
|
||||||
class REST_Facets_Controller extends REST_Controller {
|
class REST_Facets_Controller extends REST_Controller {
|
||||||
|
|
||||||
|
|
||||||
private $metadatum_repository;
|
private $metadatum_repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,16 +32,34 @@ class REST_Facets_Controller extends REST_Controller {
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check')
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
)
|
'args' => array(
|
||||||
|
'collection_id' => array(
|
||||||
|
'description' => __('Collection ID.', 'tainacan'),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
'metadatum_id' => array(
|
||||||
|
'description' => __('Metadatum ID.', 'tainacan'),
|
||||||
|
'required' => true,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
|
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<metadatum_id>[\d]+)', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<metadatum_id>[\d]+)', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check')
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
)
|
'args' => array(
|
||||||
|
'metadatum_id' => array(
|
||||||
|
'description' => __('Metadatum ID.', 'tainacan'),
|
||||||
|
'required' => true,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +210,68 @@ class REST_Facets_Controller extends REST_Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => array(
|
||||||
|
'values' => array(
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'Values for the facet', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'value' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Value of the facet', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Label of the facet', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total_children' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Total of children of the facet', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'taxonomy' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Taxonomy associated with the facet, if coming from a Taxonomy metadata type. This will be the id of the taxonomy with the prefix "tnc_col_"', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'taxonomy_id' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Taxonomy associated with the facet, if coming from a Taxonomy metadata type.', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'parent' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Parent metadatum id, if the metadtumof the facet', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total_items' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items of the facet', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'type' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Type of the metadatum related to the facet', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'hierarchy_path' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Hierarchy path to be appended to the facet label if it is related to a Taxonomy metadata and it has terms with hierarchy.', 'tainacan' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
),
|
||||||
|
'last_term' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Last term passed for pagination when Elastic Search is used.', 'tainacan' ),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -20,30 +20,9 @@ class REST_Filter_Types_Controller extends REST_Controller {
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check')
|
||||||
'args' => [
|
),
|
||||||
'filter-type' => [
|
'schema' => [$this, 'get_list_schema']
|
||||||
'description' => __('Returns the structure of the objects.'),
|
|
||||||
'items' => [
|
|
||||||
'className' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'name' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'component' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'supported_types' => [
|
|
||||||
'type' => 'array',
|
|
||||||
'items' => [
|
|
||||||
'type' => 'string'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -88,6 +67,51 @@ class REST_Filter_Types_Controller extends REST_Controller {
|
||||||
public function get_items_permissions_check( $request ) {
|
public function get_items_permissions_check( $request ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => [
|
||||||
|
'className' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The name of the class of the filter type, for example "Tainacan\Filter_Types\Checkbox".', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The name for the filter type.', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'component' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('The name of the web component used by this filter type, for example "tainacan-filter-checkbox".', 'tainacan')
|
||||||
|
],
|
||||||
|
'supported_types' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'description' => __('The list of primitive types supported by this filter type, for example, string, date, term, item.', 'tainacan')
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'type' => ['object', 'array'],
|
||||||
|
'description' => __('The options of the filter type, for example the "step" in the numeric input field.', 'tainacan'),
|
||||||
|
],
|
||||||
|
'form_component' => [
|
||||||
|
'type' => ['boolean', 'string'],
|
||||||
|
'description' => __('Whether this filter type has a form component where it\'s extra options can be set. If it has, the form web component name will be passed, for example "tainacan-filter-form-numeric-interval"', 'tainacan')
|
||||||
|
],
|
||||||
|
'use_max_options' => [
|
||||||
|
'type' => 'boolean',
|
||||||
|
'description' => __('Whether this filter type has a maximum number of options that can be selected.', 'tainacan')
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -10,7 +10,6 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
private $collection;
|
private $collection;
|
||||||
private $collection_repository;
|
private $collection_repository;
|
||||||
|
|
||||||
private $metadatum;
|
|
||||||
private $metadatum_repository;
|
private $metadatum_repository;
|
||||||
|
|
||||||
private $filter_repository;
|
private $filter_repository;
|
||||||
|
@ -42,7 +41,7 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'create_item'),
|
'callback' => array($this, 'create_item'),
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE, true)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
|
@ -57,9 +56,9 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'create_item'),
|
'callback' => array($this, 'create_item'),
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE, true)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
));
|
));
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base, array(
|
register_rest_route($this->namespace, '/' . $this->rest_base, array(
|
||||||
array(
|
array(
|
||||||
|
@ -74,19 +73,14 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
));
|
));
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<filter_id>[\d]+)', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<filter_id>[\d]+)', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||||
'permanently' => array(
|
|
||||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
|
||||||
'default' => '0'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
|
@ -95,10 +89,10 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
|
@ -228,7 +222,7 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
if (! $filter instanceof Entities\Filter) {
|
if (! $filter instanceof Entities\Filter) {
|
||||||
return new \WP_REST_Response([
|
return new \WP_REST_Response([
|
||||||
'error_message' => __('A filter with this ID was not found', 'tainacan' ),
|
'error_message' => __('A filter with this ID was not found', 'tainacan' ),
|
||||||
'filter_id' => $filter_id
|
'filter_id' => $request['filter_id']
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,26 +457,60 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
*
|
*
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null, $is_collection_level = false ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
'filter_id' => [
|
||||||
$endpoint_args = array_merge(
|
'description' => __( 'Filter ID', 'tainacan' ),
|
||||||
$endpoint_args,
|
'required' => true,
|
||||||
parent::get_wp_query_params()
|
]
|
||||||
);
|
];
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
|
||||||
$map = $this->filter_repository->get_map();
|
|
||||||
|
|
||||||
foreach ($map as $mapped => $value){
|
if ( $is_collection_level )
|
||||||
$set_ = 'set_'. $mapped;
|
$endpoint_args['collection_id'] = [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
];
|
||||||
|
|
||||||
// Show only args that has a method set
|
switch ( $method ) {
|
||||||
if( !method_exists(new Entities\Filter(), "$set_") ){
|
case \WP_REST_Server::READABLE:
|
||||||
unset($map[$mapped]);
|
$endpoint_args['context'] = array(
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => 'view',
|
||||||
|
'description' => 'The context in which the request is made.',
|
||||||
|
'enum' => array(
|
||||||
|
'view',
|
||||||
|
'edit'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$map = $this->filter_repository->get_map();
|
||||||
|
|
||||||
|
foreach ($map as $mapped => $value){
|
||||||
|
$set_ = 'set_'. $mapped;
|
||||||
|
|
||||||
|
// Show only args that has a method set
|
||||||
|
if( !method_exists(new Entities\Filter(), "$set_") ){
|
||||||
|
unset($map[$mapped]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$endpoint_args = $map;
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
$map
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $method === \WP_REST_Server::CREATABLE )
|
||||||
|
unset($endpoint_args['filter_id']);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::DELETABLE:
|
||||||
|
$endpoint_args['permanently'] = array(
|
||||||
|
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash the filter.', 'tainacan'),
|
||||||
|
'default' => 0
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -513,25 +541,20 @@ class REST_Filters_Controller extends REST_Controller {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'filter',
|
'title' => 'filter',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->filter_repository );
|
$main_schema = parent::get_repository_schema( $this->filter_repository );
|
||||||
$permissions_schema = parent::get_permissions_schema();
|
$permissions_schema = parent::get_permissions_schema();
|
||||||
|
|
||||||
// $collection_scheme = parent::get_repository_schema( $this->collection_repository );
|
|
||||||
// $metadatum_scheme = parent::get_repository_schema( $this->metadatum_repository );
|
|
||||||
|
|
||||||
$schema['properties'] = array_merge(
|
$schema['properties'] = array_merge(
|
||||||
parent::get_base_properties_schema(),
|
parent::get_base_properties_schema(),
|
||||||
$main_schema,
|
$main_schema,
|
||||||
$permissions_schema
|
$permissions_schema
|
||||||
// $collection_scheme,
|
|
||||||
// $metadatum_scheme
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -11,6 +11,9 @@ use Tainacan\Entities;
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
class REST_Importers_Controller extends REST_Controller {
|
class REST_Importers_Controller extends REST_Controller {
|
||||||
|
protected function get_schema() {
|
||||||
|
return "TODO:get_schema";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Importers_Controller constructor.
|
* REST_Importers_Controller constructor.
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Tainacan\Entities;
|
||||||
use Tainacan\Repositories;
|
use Tainacan\Repositories;
|
||||||
|
|
||||||
class REST_Item_Metadata_Controller extends REST_Controller {
|
class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
|
|
||||||
private $metadatum;
|
private $metadatum;
|
||||||
private $item_metadata_repository;
|
private $item_metadata_repository;
|
||||||
private $item_repository;
|
private $item_repository;
|
||||||
|
@ -46,6 +47,16 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item_metadatum_value'),
|
'callback' => array($this, 'get_item_metadatum_value'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
|
'args' => array(
|
||||||
|
'item_id' => array(
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
'metadatum_id' => array(
|
||||||
|
'description' => __( 'Metadatum ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
|
@ -56,8 +67,10 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check')
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE)
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<item_id>[\d]+)/metadata',
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<item_id>[\d]+)/metadata',
|
||||||
|
@ -67,18 +80,29 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||||
)
|
),
|
||||||
|
'schema' => [$this, 'get_list_schema'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<item_id>[\d]+)/metadata-sections/(?P<metadata_section_id>[\d|default_section]+)',
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<item_id>[\d]+)/metadata-sections/(?P<metadata_section_id>[\d|default_section]+)',
|
||||||
array(
|
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
array(
|
||||||
'callback' => array($this, 'get_items'),
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'callback' => array($this, 'get_items'),
|
||||||
),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
)
|
'args' => array_merge(
|
||||||
);
|
array(
|
||||||
|
'metadata_section_id' => array(
|
||||||
|
'description' => __( 'Metadata Section ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'schema' => [$this, 'get_list_schema'],
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,26 +310,38 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
|
'item_id' => [
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
if ($method === \WP_REST_Server::READABLE) {
|
||||||
$endpoint_args = array_merge(
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args,
|
$endpoint_args,
|
||||||
$this->get_wp_query_params()
|
$this->get_wp_query_params()
|
||||||
);
|
);
|
||||||
} elseif ($method === \WP_REST_Server::EDITABLE) {
|
} elseif ($method === \WP_REST_Server::EDITABLE) {
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
];
|
||||||
$endpoint_args['values'] = [
|
$endpoint_args['values'] = [
|
||||||
'type' => ['array', 'string', 'object', 'integer'],
|
'type' => ['array', 'string', 'object', 'integer'],
|
||||||
'items' => [
|
'items' => [ 'type' => ['array', 'string', 'object', 'integer'] ],
|
||||||
'type' => ['array', 'string', 'object', 'integer']
|
|
||||||
],
|
|
||||||
'description' => __('The value(s) of item metadata')
|
'description' => __('The value(s) of item metadata')
|
||||||
];
|
];
|
||||||
$endpoint_args['parent_meta_id'] = [
|
$endpoint_args['parent_meta_id'] = [
|
||||||
'type' => ['array', 'string', 'object', 'integer'],
|
'type' => ['array', 'string', 'object', 'integer'],
|
||||||
'items' => ['type' => ['array', 'string', 'object', 'integer'] ],
|
'items' => ['type' => ['string', 'integer'] ],
|
||||||
'description' => __('The parent meta ID for the item metadata children group')
|
'description' => __('The parent meta ID for the item metadata children group')
|
||||||
];
|
];
|
||||||
|
} elseif ($method === \WP_REST_Server::DELETABLE) {
|
||||||
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -392,11 +428,48 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_metadata_value($is_multiple, $value) {
|
private function get_metadata_value($is_multiple, $value) {
|
||||||
if ($is_multiple) {
|
if ( $is_multiple )
|
||||||
return $value;
|
return $value;
|
||||||
} elseif (is_array($value)) {
|
elseif ( is_array($value) )
|
||||||
return implode(' ', $value);
|
return implode(' ', $value);
|
||||||
}
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => array(
|
||||||
|
'value' => array(
|
||||||
|
'type' => ['array', 'string', 'integer', 'boolean', 'object'],
|
||||||
|
'description' => __( 'Value', 'tainacan' ),
|
||||||
|
),
|
||||||
|
'value_as_string' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Value as String', 'tainacan' ),
|
||||||
|
),
|
||||||
|
'value_as_html' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Value as HTML', 'tainacan' ),
|
||||||
|
),
|
||||||
|
'parent_meta_id' => array(
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The parent meta ID for the item metadata children group', 'tainacan' ),
|
||||||
|
),
|
||||||
|
'item' => array(
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => parent::get_repository_schema($this->item_repository),
|
||||||
|
),
|
||||||
|
'metadatum' => array(
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => parent::get_repository_schema($this->metadatum_repository),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
private $item_metadata;
|
private $item_metadata;
|
||||||
private $collections_repository;
|
private $collections_repository;
|
||||||
private $metadatum_repository;
|
private $metadatum_repository;
|
||||||
|
private $terms_repository;
|
||||||
|
private $filters_repository;
|
||||||
|
private $taxonomy_repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Items_Controller constructor.
|
* REST_Items_Controller constructor.
|
||||||
|
@ -53,7 +56,14 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => array_merge([
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
$this->get_wp_query_params()
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
|
@ -61,6 +71,7 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_list_schema'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
|
@ -82,13 +93,9 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE),
|
||||||
'permanently' => array(
|
|
||||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection', 'tainacan'),
|
|
||||||
'default' => '0'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
|
@ -98,7 +105,14 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item_attachments'),
|
'callback' => array($this, 'get_item_attachments'),
|
||||||
'permission_callback' => array($this, 'get_item_attachments_permissions_check'),
|
'permission_callback' => array($this, 'get_item_attachments_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => array_merge([
|
||||||
|
'item_id' => [
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
$this->get_wp_query_params()
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_attachments_schema'],
|
'schema' => [$this, 'get_attachments_schema'],
|
||||||
)
|
)
|
||||||
|
@ -112,6 +126,7 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => $this->get_wp_query_params(),
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_list_schema'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
|
@ -122,6 +137,14 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'duplicate_item'),
|
'callback' => array($this, 'duplicate_item'),
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => array(
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
],
|
||||||
|
'item_id' => [
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
],
|
||||||
'copies' => array(
|
'copies' => array(
|
||||||
'description' => __('Number of copies to be created', 'tainacan'),
|
'description' => __('Number of copies to be created', 'tainacan'),
|
||||||
'default' => 1,
|
'default' => 1,
|
||||||
|
@ -129,10 +152,13 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
),
|
),
|
||||||
'status' => array(
|
'status' => array(
|
||||||
'description' => __('Try to assign the specified status to the duplicates if they validate. By default it will save them as drafts.', 'tainacan'),
|
'description' => __('Try to assign the specified status to the duplicates if they validate. By default it will save them as drafts.', 'tainacan'),
|
||||||
'type' => 'string'
|
'type' => 'string',
|
||||||
|
'enum' => array('draft', 'publish', 'private', 'trash'),
|
||||||
|
'default' => 'draft'
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
|
@ -144,6 +170,7 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'submission_item_permissions_check'),
|
'permission_callback' => array($this, 'submission_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
|
@ -153,7 +180,18 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'submission_item_finish'),
|
'callback' => array($this, 'submission_item_finish'),
|
||||||
'permission_callback' => array($this, 'submission_item_permissions_check'),
|
'permission_callback' => array($this, 'submission_item_permissions_check'),
|
||||||
|
'args' => array(
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
],
|
||||||
|
'submission_id' => [
|
||||||
|
'description' => __( 'Submission ID', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
],
|
||||||
|
)
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1447,35 +1485,56 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ){
|
public function get_endpoint_args_for_item_schema( $method = null ){
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
|
'item_id' => [
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
switch ( $method ) {
|
||||||
$endpoint_args['context'] = array(
|
case \WP_REST_Server::READABLE:
|
||||||
'type' => 'string',
|
$endpoint_args['context'] = array(
|
||||||
'default' => 'view',
|
'type' => 'string',
|
||||||
'description' => 'The context in which the request is made.',
|
'default' => 'view',
|
||||||
'enum' => array(
|
'description' => __( 'Scope under which the request is made; determines fields present in response.', 'tainacan' ),
|
||||||
'view',
|
'enum' => array(
|
||||||
'edit'
|
'view',
|
||||||
),
|
'edit'
|
||||||
);
|
),
|
||||||
$endpoint_args = array_merge(
|
);
|
||||||
$endpoint_args,
|
$endpoint_args = array_merge(
|
||||||
parent::get_fetch_only_param()
|
$endpoint_args,
|
||||||
);
|
parent::get_fetch_only_param()
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
);
|
||||||
$map = $this->items_repository->get_map();
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$map = $this->items_repository->get_map();
|
||||||
|
|
||||||
foreach ($map as $mapped => $value){
|
foreach ($map as $mapped => $value){
|
||||||
$set_ = 'set_'. $mapped;
|
$set_ = 'set_'. $mapped;
|
||||||
|
|
||||||
// Show only args that has a method set
|
// Show only args that has a method set
|
||||||
if( !method_exists($this->item, "$set_") ){
|
if( !method_exists($this->item, "$set_") ){
|
||||||
unset($map[$mapped]);
|
unset($map[$mapped]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args = $map;
|
$endpoint_args,
|
||||||
|
$map
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $method === \WP_REST_Server::CREATABLE )
|
||||||
|
unset($endpoint_args['item_id']);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::DELETABLE:
|
||||||
|
$endpoint_args['permanently'] = array(
|
||||||
|
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection', 'tainacan'),
|
||||||
|
'default' => '0'
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -1501,14 +1560,13 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
return $query_params;
|
return $query_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_attachments_schema() {
|
function process_request_filters($args) {
|
||||||
$schema = [
|
return $this->prepare_filters($args);
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
}
|
||||||
'title' => 'collection',
|
|
||||||
'type' => 'object'
|
|
||||||
];
|
|
||||||
|
|
||||||
$schema = [
|
function get_attachments_schema() {
|
||||||
|
|
||||||
|
$properties = [
|
||||||
'title' => [
|
'title' => [
|
||||||
'description' => esc_html__('The attachment title', 'tainacan'),
|
'description' => esc_html__('The attachment title', 'tainacan'),
|
||||||
'type' => 'string'
|
'type' => 'string'
|
||||||
|
@ -1552,17 +1610,41 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'attachments',
|
||||||
|
'type' => 'array',
|
||||||
|
'tags' => ['attachments', $this->rest_base],
|
||||||
|
'items' => array(
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => array_merge(
|
||||||
|
parent::get_base_properties_schema(),
|
||||||
|
$properties
|
||||||
|
)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'item',
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
];
|
||||||
|
|
||||||
|
$main_schema = parent::get_repository_schema( $this->items_repository );
|
||||||
|
$permissions_schema = parent::get_permissions_schema();
|
||||||
|
|
||||||
$schema['properties'] = array_merge(
|
$schema['properties'] = array_merge(
|
||||||
parent::get_base_properties_schema(),
|
parent::get_base_properties_schema(),
|
||||||
$schema
|
$main_schema,
|
||||||
|
$permissions_schema
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_request_filters($args) {
|
|
||||||
return $this->prepare_filters($args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<log_id>[\d]+)',
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<log_id>[\d]+)',
|
||||||
|
@ -37,6 +37,12 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
|
'args' => array(
|
||||||
|
'log_id' => array(
|
||||||
|
'description' => __( 'Log ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
|
@ -47,9 +53,17 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'collection_id' => array(
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/item/(?P<item_id>[\d]+)/' . $this->rest_base,
|
register_rest_route($this->namespace, '/item/(?P<item_id>[\d]+)/' . $this->rest_base,
|
||||||
|
@ -58,9 +72,17 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'item_id' => array(
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/filter/(?P<filter_id>[\d]+)/' . $this->rest_base,
|
register_rest_route($this->namespace, '/filter/(?P<filter_id>[\d]+)/' . $this->rest_base,
|
||||||
|
@ -69,9 +91,17 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'filter_id' => array(
|
||||||
|
'description' => __( 'Filter ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/metadatum/(?P<metadatum_id>[\d]+)/' . $this->rest_base,
|
register_rest_route($this->namespace, '/metadatum/(?P<metadatum_id>[\d]+)/' . $this->rest_base,
|
||||||
|
@ -80,9 +110,17 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'metadatum_id' => array(
|
||||||
|
'description' => __( 'Metadatum ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/taxonomy/(?P<taxonomy_id>[\d]+)/' . $this->rest_base,
|
register_rest_route($this->namespace, '/taxonomy/(?P<taxonomy_id>[\d]+)/' . $this->rest_base,
|
||||||
|
@ -91,9 +129,17 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'taxonomy_id' => array(
|
||||||
|
'description' => __( 'Taxonomy ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/term/(?P<term_id>[\d]+)/' . $this->rest_base,
|
register_rest_route($this->namespace, '/term/(?P<term_id>[\d]+)/' . $this->rest_base,
|
||||||
|
@ -102,9 +148,17 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'term_id' => array(
|
||||||
|
'description' => __( 'Term ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema( \WP_REST_Server::READABLE)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -334,11 +388,14 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [];
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
|
||||||
$endpoint_args = array_merge(
|
switch ( $method ) {
|
||||||
$endpoint_args,
|
case \WP_REST_Server::READABLE:
|
||||||
parent::get_wp_query_params()
|
$endpoint_args = array_merge(
|
||||||
);
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -348,7 +405,8 @@ class REST_Logs_Controller extends REST_Controller {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'log',
|
'title' => 'log',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ]
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->logs_repository );
|
$main_schema = parent::get_repository_schema( $this->logs_repository );
|
||||||
|
|
|
@ -7,8 +7,6 @@ use Tainacan\Entities;
|
||||||
use Tainacan\Repositories;
|
use Tainacan\Repositories;
|
||||||
|
|
||||||
class REST_Metadata_Controller extends REST_Controller {
|
class REST_Metadata_Controller extends REST_Controller {
|
||||||
private $item_metadata_repository;
|
|
||||||
private $item_repository;
|
|
||||||
private $collection_repository;
|
private $collection_repository;
|
||||||
private $metadatum_repository;
|
private $metadatum_repository;
|
||||||
|
|
||||||
|
@ -25,8 +23,6 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function init_objects() {
|
public function init_objects() {
|
||||||
$this->metadatum_repository = Repositories\Metadata::get_instance();
|
$this->metadatum_repository = Repositories\Metadata::get_instance();
|
||||||
$this->item_metadata_repository = Repositories\Item_Metadata::get_instance();
|
|
||||||
$this->item_repository = Repositories\Items::get_instance();
|
|
||||||
$this->collection_repository = Repositories\Collections::get_instance();
|
$this->collection_repository = Repositories\Collections::get_instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +44,15 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => [
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'metadatum_id' => [
|
||||||
|
'description' => __( 'Metadatum ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
'context' => array(
|
'context' => array(
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
|
@ -58,18 +62,19 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
'edit'
|
'edit'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
'callback' => array($this, 'update_item'),
|
'callback' => array($this, 'update_item'),
|
||||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE, true)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE, true)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
|
@ -80,15 +85,23 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
$this->get_wp_query_params()
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'create_item'),
|
'callback' => array($this, 'create_item'),
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE, true),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base,
|
register_rest_route($this->namespace, '/' . $this->rest_base,
|
||||||
|
@ -105,7 +118,7 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_list_schema'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/'. $this->rest_base . '/(?P<metadatum_id>[\d]+)',
|
register_rest_route($this->namespace, '/'. $this->rest_base . '/(?P<metadatum_id>[\d]+)',
|
||||||
|
@ -114,17 +127,12 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => [
|
||||||
'context' => array(
|
'metadatum_id' => [
|
||||||
'type' => 'string',
|
'description' => __( 'Metadatum ID', 'tainacan' ),
|
||||||
'default' => 'view',
|
'required' => true,
|
||||||
'description' => 'The context in which the request is made.',
|
],
|
||||||
'enum' => array(
|
],
|
||||||
'view',
|
|
||||||
'edit'
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
|
@ -135,7 +143,8 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check')
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema'],
|
'schema' => [$this, 'get_schema'],
|
||||||
)
|
)
|
||||||
|
@ -582,26 +591,57 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null, $is_collection_level = false ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
'metadatum_id' => [
|
||||||
$endpoint_args = array_merge(
|
'description' => __( 'Metadatum ID', 'tainacan' ),
|
||||||
$endpoint_args,
|
'required' => true,
|
||||||
parent::get_wp_query_params()
|
]
|
||||||
);
|
];
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
|
||||||
$map = $this->metadatum_repository->get_map();
|
|
||||||
|
|
||||||
foreach ($map as $mapped => $value){
|
if ( $is_collection_level )
|
||||||
$set_ = 'set_'. $mapped;
|
$endpoint_args['collection_id'] = [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
switch ( $method ) {
|
||||||
|
case \WP_REST_Server::READABLE:
|
||||||
|
$endpoint_args['context'] = array(
|
||||||
|
'description' => __( 'Scope under which the request is made; determines fields present in response.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => 'view',
|
||||||
|
'enum' => array(
|
||||||
|
'view',
|
||||||
|
'edit',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$map = $this->metadatum_repository->get_map();
|
||||||
|
|
||||||
// Show only args that has a method set
|
foreach ($map as $mapped => $value){
|
||||||
if( !method_exists(new Entities\Metadatum(), "$set_") ){
|
$set_ = 'set_'. $mapped;
|
||||||
unset($map[$mapped]);
|
|
||||||
|
// Show only args that has a method set
|
||||||
|
if ( !method_exists(new Entities\Metadatum(), "$set_") ){
|
||||||
|
unset($map[$mapped]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$endpoint_args = array_merge(
|
||||||
$endpoint_args = $map;
|
$endpoint_args,
|
||||||
|
$map
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $method === \WP_REST_Server::CREATABLE )
|
||||||
|
unset($endpoint_args['metadatum_id']);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -611,23 +651,17 @@ class REST_Metadata_Controller extends REST_Controller {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'metadatum',
|
'title' => 'metadatum',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->metadatum_repository );
|
$main_schema = parent::get_repository_schema( $this->metadatum_repository );
|
||||||
$permissions_schema = parent::get_permissions_schema();
|
$permissions_schema = parent::get_permissions_schema();
|
||||||
|
|
||||||
// $item_metadata_scheme = parent::get_repository_schema( $this->item_metadata_repository );
|
|
||||||
// $item_scheme = parent::get_repository_schema( $this->item_repository );
|
|
||||||
// $collection_scheme = parent::get_repository_schema( $this->collection_repository );
|
|
||||||
|
|
||||||
$schema['properties'] = array_merge(
|
$schema['properties'] = array_merge(
|
||||||
parent::get_base_properties_schema(),
|
parent::get_base_properties_schema(),
|
||||||
$main_schema,
|
$main_schema,
|
||||||
$permissions_schema
|
$permissions_schema
|
||||||
// $item_metadata_scheme,
|
|
||||||
// $item_scheme,
|
|
||||||
// $collection_scheme
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
|
@ -7,6 +7,11 @@ use Tainacan\Entities;
|
||||||
use Tainacan\Repositories;
|
use Tainacan\Repositories;
|
||||||
|
|
||||||
class REST_Metadata_Sections_Controller extends REST_Controller {
|
class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
|
|
||||||
|
private $metadata_sections_repository;
|
||||||
|
private $metadata_repository;
|
||||||
|
private $collection_repository;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->rest_base = 'metadata-sections';
|
$this->rest_base = 'metadata-sections';
|
||||||
|
@ -42,7 +47,15 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => [
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'metadata_section_id' => [
|
||||||
|
'description' => __( 'Metadata Section ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
'context' => array(
|
'context' => array(
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
|
@ -52,7 +65,7 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
'edit'
|
'edit'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
|
@ -64,6 +77,7 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
|
@ -74,7 +88,15 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params(),
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
$this->get_wp_query_params()
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
|
@ -82,7 +104,7 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<metadata_section_id>[\d|default_section]+)/metadata',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<metadata_section_id>[\d|default_section]+)/metadata',
|
||||||
|
@ -102,10 +124,10 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_metadata'),
|
'callback' => array($this, 'delete_metadata'),
|
||||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE),
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_metadata_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -594,7 +616,7 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
$query_params = array_merge($query_params, parent::get_wp_query_params());
|
$query_params = array_merge($query_params, parent::get_wp_query_params());
|
||||||
|
|
||||||
$query_params['name'] = array(
|
$query_params['name'] = array(
|
||||||
'description' => __('Limits the result set to metadata with a specific name'),
|
'description' => __('Limits the result set to metadata sections with a specific name'),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -610,51 +632,80 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
'metadata_section_id' => [
|
||||||
$endpoint_args = array_merge(
|
'description' => __( 'Metadata Section ID', 'tainacan' ),
|
||||||
$endpoint_args,
|
'required' => true,
|
||||||
parent::get_wp_query_params()
|
],
|
||||||
);
|
'collection_id' => [
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
$map = $this->metadata_sections_repository->get_map();
|
'required' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($map as $mapped => $value){
|
switch ( $method ) {
|
||||||
$set_ = 'set_'. $mapped;
|
case \WP_REST_Server::READABLE:
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$map = $this->metadata_sections_repository->get_map();
|
||||||
|
|
||||||
// Show only args that has a method set
|
foreach ($map as $mapped => $value){
|
||||||
if( !method_exists(new Entities\Metadatum(), "$set_") ){
|
$set_ = 'set_'. $mapped;
|
||||||
unset($map[$mapped]);
|
|
||||||
|
// Show only args that has a method set
|
||||||
|
if( !method_exists(new Entities\Metadatum(), "$set_") ){
|
||||||
|
unset($map[$mapped]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
$map
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $method === \WP_REST_Server::CREATABLE )
|
||||||
|
unset($endpoint_args['metadata_section_id']);
|
||||||
|
|
||||||
$endpoint_args = $map;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_metadata_list_schema() {
|
||||||
|
$metadatum_schema = parent::get_repository_schema($this->metadata_repository);
|
||||||
|
return [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => 'metadata',
|
||||||
|
'tags' => [$this->rest_base, 'metadata'],
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => array(
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => $metadatum_schema,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
function get_schema() {
|
function get_schema() {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'metadatum',
|
'title' => 'metadata-section',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->metadata_sections_repository );
|
$main_schema = parent::get_repository_schema( $this->metadata_sections_repository );
|
||||||
$permissions_schema = parent::get_permissions_schema();
|
$permissions_schema = parent::get_permissions_schema();
|
||||||
|
|
||||||
// $item_metadata_scheme = parent::get_repository_schema( $this->item_metadata_repository );
|
|
||||||
// $item_scheme = parent::get_repository_schema( $this->item_repository );
|
|
||||||
// $collection_scheme = parent::get_repository_schema( $this->collection_repository );
|
|
||||||
|
|
||||||
$schema['properties'] = array_merge(
|
$schema['properties'] = array_merge(
|
||||||
parent::get_base_properties_schema(),
|
parent::get_base_properties_schema(),
|
||||||
$main_schema,
|
$main_schema,
|
||||||
$permissions_schema
|
$permissions_schema
|
||||||
// $item_metadata_scheme,
|
|
||||||
// $item_scheme,
|
|
||||||
// $collection_scheme
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
|
@ -21,47 +21,8 @@ class REST_Metadata_Types_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
'args' => [
|
),
|
||||||
'metadata-type' => [
|
'schema' => [$this, 'get_list_schema']
|
||||||
'description' => __('Returns the structure of the objects.'),
|
|
||||||
'items' => [
|
|
||||||
'errors' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'component' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'primitive_type' => [
|
|
||||||
'type' => ['array','string'],
|
|
||||||
'items' => [
|
|
||||||
'type' => 'string'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'related_mapped_prop' => [
|
|
||||||
'type' => 'boolean'
|
|
||||||
],
|
|
||||||
'options' => [
|
|
||||||
'type' => 'array'
|
|
||||||
],
|
|
||||||
'className' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'core' => [
|
|
||||||
'type' => 'boolean'
|
|
||||||
],
|
|
||||||
'form_component' => [
|
|
||||||
'type' => 'boolean'
|
|
||||||
],
|
|
||||||
'preview_template' => [
|
|
||||||
'type' => 'string'
|
|
||||||
],
|
|
||||||
'sortable' => [
|
|
||||||
'type' => 'boolean'
|
|
||||||
],
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -107,6 +68,71 @@ class REST_Metadata_Types_Controller extends REST_Controller {
|
||||||
public function get_items_permissions_check( $request ) {
|
public function get_items_permissions_check( $request ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => [
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('The name of the metadata type.', 'tainacan')
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('The description of the metadata type.', 'tainacan')
|
||||||
|
],
|
||||||
|
'errors' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('Validation errors for the metadata type.', 'tainacan')
|
||||||
|
],
|
||||||
|
'component' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('The name of the web component used by this metadata type, for example "tainacan-taxonomy".', 'tainacan')
|
||||||
|
],
|
||||||
|
'primitive_type' => [
|
||||||
|
'type' => ['array','string'],
|
||||||
|
'items' => [
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'description' => __('The primitive type of the metadata type, how it is saved in the WordPress database. For example "string" or "term".', 'tainacan'),
|
||||||
|
],
|
||||||
|
'related_mapped_prop' => [
|
||||||
|
'type' => ['boolean', 'string'],
|
||||||
|
'description' => __('Whether this metadata type is related to a mapped property from the post original data.', 'tainacan')
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'type' => ['object', 'array'],
|
||||||
|
'description' => __('The options of the metadata type, for example the related taxonomy id in the Taxonomy metadata type.', 'tainacan'),
|
||||||
|
],
|
||||||
|
'className' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('The name of the class of the metadata type, for example "Tainacan\Metadata_Types\Taxonomy".', 'tainacan')
|
||||||
|
],
|
||||||
|
'core' => [
|
||||||
|
'type' => 'boolean',
|
||||||
|
'description' => __('Whether this metadata type is a core metadata type.', 'tainacan')
|
||||||
|
],
|
||||||
|
'form_component' => [
|
||||||
|
'type' => ['boolean', 'string'],
|
||||||
|
'description' => __('Whether this metadata type has a form component where it\'s extra options can be set. If it has, the form web component name will be passed, for example "tainacan-form-taxonomy"', 'tainacan')
|
||||||
|
],
|
||||||
|
'preview_template' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __('An HTML template representing a version of the metadata field that is visible inside a tooltip for demonstrating the metadata type.', 'tainacan')
|
||||||
|
],
|
||||||
|
'sortable' => [
|
||||||
|
'type' => 'boolean',
|
||||||
|
'description' => __('Whether this metadata type will generate metadata that should be available as sorting options in the items list interface.', 'tainacan')
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -6,6 +6,9 @@ use \Tainacan\API\REST_Controller;
|
||||||
use Tainacan\Entities\Metadatum;
|
use Tainacan\Entities\Metadatum;
|
||||||
|
|
||||||
class REST_Metadatum_Mappers_Controller extends REST_Controller {
|
class REST_Metadatum_Mappers_Controller extends REST_Controller {
|
||||||
|
protected function get_schema() {
|
||||||
|
return "TODO:get_schema";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Metadatum_Mappers_Controller constructor.
|
* REST_Metadatum_Mappers_Controller constructor.
|
||||||
|
|
|
@ -34,8 +34,10 @@ class REST_Oaipmh_Expose_Controller extends REST_Controller {
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_verb'),
|
'callback' => array($this, 'get_verb'),
|
||||||
'permission_callback' => array($this, 'get_verb_permissions_check')
|
'permission_callback' => array($this, 'get_verb_permissions_check'),
|
||||||
)
|
'args' => $this->get_verb_params()
|
||||||
|
),
|
||||||
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,4 +126,39 @@ class REST_Oaipmh_Expose_Controller extends REST_Controller {
|
||||||
|
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_verb_params() {
|
||||||
|
return [
|
||||||
|
'verb' => [
|
||||||
|
'enum' => ['ListSets', 'ListRecords', 'ListIdentifiers', 'GetRecord', 'ListMetadataFormats', 'Identify'],
|
||||||
|
'required' => true,
|
||||||
|
'description' => __( 'The OAI-PMH verb to execute.', 'tainacan' ),
|
||||||
|
'type=' => 'string'
|
||||||
|
],
|
||||||
|
'resumptionToken' => [
|
||||||
|
'description' => __( 'The resumptionToken to continue a previous request.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'metadataPrefix' => [
|
||||||
|
'description' => __( 'The metadataPrefix to use in the request. Used when the verb is "ListRecords", "ListIdentifiers" and "GetRecord"', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'identifier' => [
|
||||||
|
'description' => __( 'The identifier to use in the request. Used when the verb is "GetRecord".', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'string',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'description' => __( 'Result of the OAI-PMH Exposer for the provided verb.', 'tainacan'),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -8,6 +8,10 @@ use Tainacan\Repositories;
|
||||||
|
|
||||||
class REST_Reports_Controller extends REST_Controller {
|
class REST_Reports_Controller extends REST_Controller {
|
||||||
|
|
||||||
|
private $taxonomy_repository;
|
||||||
|
private $metadatum_repository;
|
||||||
|
private $collections_repository;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->rest_base = 'reports';
|
$this->rest_base = 'reports';
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -15,7 +19,6 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init_objects() {
|
public function init_objects() {
|
||||||
$this->items_repository = Repositories\Items::get_instance();
|
|
||||||
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
|
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
|
||||||
$this->metadatum_repository = Repositories\Metadata::get_instance();
|
$this->metadatum_repository = Repositories\Metadata::get_instance();
|
||||||
$this->collections_repository = Repositories\Collections::get_instance();
|
$this->collections_repository = Repositories\Collections::get_instance();
|
||||||
|
@ -33,19 +36,9 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_collections'),
|
'callback' => array($this, 'get_collections'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_endpoint_args_for_item_schema()
|
||||||
'force' => [
|
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_collection_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/summary',
|
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/summary',
|
||||||
|
@ -54,19 +47,17 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_summary'),
|
'callback' => array($this, 'get_summary'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => array_merge(
|
||||||
'force' => [
|
array(
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
'collection_id' => array(
|
||||||
'type' => 'string',
|
'description' => __('Collection ID.', 'tainacan'),
|
||||||
'default' => 'no',
|
'required' => true,
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
),
|
||||||
'enum' => array(
|
),
|
||||||
'no',
|
$this->get_endpoint_args_for_item_schema()
|
||||||
'yes'
|
)
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_collection_summary_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/metadata',
|
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/metadata',
|
||||||
|
@ -75,19 +66,17 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_stats_collection_metadata'),
|
'callback' => array($this, 'get_stats_collection_metadata'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => array_merge(
|
||||||
'force' => [
|
array(
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
'collection_id' => array(
|
||||||
'type' => 'string',
|
'description' => __('Collection ID.', 'tainacan'),
|
||||||
'default' => 'no',
|
'required' => true,
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
),
|
||||||
'enum' => array(
|
),
|
||||||
'no',
|
$this->get_endpoint_args_for_item_schema()
|
||||||
'yes'
|
)
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_metadata_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/metadata',
|
register_rest_route($this->namespace, $this->rest_base . '/metadata',
|
||||||
|
@ -96,19 +85,9 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_stats_collection_metadata'),
|
'callback' => array($this, 'get_stats_collection_metadata'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_endpoint_args_for_item_schema()
|
||||||
'force' => [
|
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_metadata_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/repository/summary',
|
register_rest_route($this->namespace, $this->rest_base . '/repository/summary',
|
||||||
|
@ -117,19 +96,9 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_summary'),
|
'callback' => array($this, 'get_summary'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_endpoint_args_for_item_schema()
|
||||||
'force' => [
|
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_summary_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/taxonomy',
|
register_rest_route($this->namespace, $this->rest_base . '/taxonomy',
|
||||||
|
@ -138,19 +107,9 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_taxonomies_list'),
|
'callback' => array($this, 'get_taxonomies_list'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => $this->get_endpoint_args_for_item_schema()
|
||||||
'force' => [
|
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_taxonomy_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/taxonomy/(?P<taxonomy_id>[\d]+)',
|
register_rest_route($this->namespace, $this->rest_base . '/taxonomy/(?P<taxonomy_id>[\d]+)',
|
||||||
|
@ -159,19 +118,17 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_taxonomy'),
|
'callback' => array($this, 'get_taxonomy'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => array_merge(
|
||||||
'force' => [
|
array(
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
'taxonomy_id' => array(
|
||||||
'type' => 'string',
|
'description' => __('Taxonomy ID.', 'tainacan'),
|
||||||
'default' => 'no',
|
'required' => true,
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
),
|
||||||
'enum' => array(
|
),
|
||||||
'no',
|
$this->get_endpoint_args_for_item_schema()
|
||||||
'yes'
|
)
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_taxonomy_terms_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/activities',
|
register_rest_route($this->namespace, $this->rest_base . '/activities',
|
||||||
|
@ -180,29 +137,23 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_activities'),
|
'callback' => array($this, 'get_activities'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => array_merge(
|
||||||
'start' => [
|
[
|
||||||
'title' => __( 'start Date', 'tainacan' ),
|
'start' => [
|
||||||
'type' => 'string',
|
'title' => __( 'start Date', 'tainacan' ),
|
||||||
'format' => 'date-time',
|
'type' => 'string',
|
||||||
],
|
'format' => 'date-time',
|
||||||
'end' => [
|
],
|
||||||
'title' => __( 'start Date', 'tainacan' ),
|
'end' => [
|
||||||
'type' => 'string',
|
'title' => __( 'start Date', 'tainacan' ),
|
||||||
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
|
'type' => 'string',
|
||||||
|
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'force' => [
|
$this->get_endpoint_args_for_item_schema()
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
)
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_activities_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/activities',
|
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/activities',
|
||||||
|
@ -211,29 +162,27 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_activities'),
|
'callback' => array($this, 'get_activities'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => array_merge(
|
||||||
'start' => [
|
[
|
||||||
'title' => __( 'start Date', 'tainacan' ),
|
'collection_id' => [
|
||||||
'type' => 'string',
|
'description' => __('Collection ID.', 'tainacan'),
|
||||||
'format' => 'date-time',
|
'required' => true,
|
||||||
],
|
],
|
||||||
'end' => [
|
'start' => [
|
||||||
'title' => __( 'start Date', 'tainacan' ),
|
'title' => __( 'start Date', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
|
'format' => 'date-time',
|
||||||
|
],
|
||||||
|
'end' => [
|
||||||
|
'title' => __( 'start Date', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'force' => [
|
$this->get_endpoint_args_for_item_schema()
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
)
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_activities_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/metadata/(?P<metadata_id>[\d]+)',
|
register_rest_route($this->namespace, $this->rest_base . '/collection/(?P<collection_id>[\d]+)/metadata/(?P<metadata_id>[\d]+)',
|
||||||
|
@ -242,23 +191,27 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_metadata'),
|
'callback' => array($this, 'get_metadata'),
|
||||||
'permission_callback' => array($this, 'reports_permissions_check'),
|
'permission_callback' => array($this, 'reports_permissions_check'),
|
||||||
'args' => [
|
'args' => array_merge(
|
||||||
'parent' => [
|
[
|
||||||
'title' => __( 'parent', 'tainacan' ),
|
'parent' => [
|
||||||
'type' => 'integer',
|
'title' => __( 'parent', 'tainacan' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
],
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __('Collection ID.', 'tainacan'),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'metadata_id' => [
|
||||||
|
'description' => __('Metadatum ID.', 'tainacan'),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'force' => [
|
$this->get_endpoint_args_for_item_schema()
|
||||||
'title' => __( 'Force regenerate', 'tainacan' ),
|
)
|
||||||
'type' => 'string',
|
|
||||||
'default' => 'no',
|
|
||||||
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
|
||||||
'enum' => array(
|
|
||||||
'no',
|
|
||||||
'yes'
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
|
'schema' => array($this, 'get_collection_metadatum_schema'),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -880,6 +833,567 @@ class REST_Reports_Controller extends REST_Controller {
|
||||||
$data['report_cached_on'] = (new \DateTime())->format('Y-m-d H:i:s');
|
$data['report_cached_on'] = (new \DateTime())->format('Y-m-d H:i:s');
|
||||||
return set_transient($this->prefix_transient_cahce . $key, $data, $expiration);
|
return set_transient($this->prefix_transient_cahce . $key, $data, $expiration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
|
$endpoint_args = [
|
||||||
|
'force' => [
|
||||||
|
'title' => __( 'Force regenerate', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => 'no',
|
||||||
|
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
|
||||||
|
'enum' => array(
|
||||||
|
'no',
|
||||||
|
'yes'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $endpoint_args;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_metadata_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-metadata";
|
||||||
|
$schema['properties']['totals'] = [
|
||||||
|
'name' => 'totals',
|
||||||
|
'description' => __( 'Information about the amount of existing metadata', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'metadata' => [
|
||||||
|
'description' => __( 'Total of metadata per status', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of metadata of any status', 'tainacan' )
|
||||||
|
],
|
||||||
|
'public' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of public metadata', 'tainacan' )
|
||||||
|
],
|
||||||
|
'private' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of private metadata', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'metadata_per_type' => [
|
||||||
|
'description' => __( 'Total of metadata per type', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'[metadata_type_name:string]' => [
|
||||||
|
'description' => __( 'Dynamic object, where the keys are the metadata type slug', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Metadata type name', 'tainacan' )
|
||||||
|
],
|
||||||
|
'count' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of metadata of this type', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$schema['properties']['distribution'] = [
|
||||||
|
'description' => __( 'Distribution of how much each metadata has values in the items', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'description' => __( 'Metadatum distribution information', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'name' => [
|
||||||
|
'description' => __( 'Metadatum name', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'parent_name' => [
|
||||||
|
'description' => __( 'Metadatum parent name, if a child of a compound metadatum', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Metadatum ID', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
],
|
||||||
|
'fill_percentage' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Percentage of items that have this metadatum filled', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_collection_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-collection";
|
||||||
|
$schema['properties']['list'] = [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'[tnc_col_<ID>_item:string]' => [
|
||||||
|
'description' => __( 'Dynamic object, where the key is the collection post type', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection name', 'tainacan' )
|
||||||
|
],
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Object containing summary of items totals', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Summation of the total of items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'trash' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of trashed items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'publish' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of published items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'draft' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of draft items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'private' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of private items', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_collection_metadatum_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-collection";
|
||||||
|
$schema['properties']['list'] = [
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'List of item metadata objects', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'description' => __( 'Item metadatum object', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'type' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Metadatum type', 'tainacan' )
|
||||||
|
],
|
||||||
|
'value' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Metadatum value', 'tainacan' )
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Metadatum value label (used when the value is relationship item or a taxonomy term)', 'tainacan' )
|
||||||
|
],
|
||||||
|
'parent' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Term parent id, if the value is a term that has a parent term', 'tainacan' )
|
||||||
|
],
|
||||||
|
'totel_items' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items that have this value', 'tainacan' )
|
||||||
|
],
|
||||||
|
'totel_children' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of child terms, if the value is a term that has child terms', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_collection_summary_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-collection-summary";
|
||||||
|
$schema['properties']['totals'] = [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Total of items', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Summation of the total of items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'trash' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of trashed items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'publish' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of published items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'draft' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of draft items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'private' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of private items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'restrict' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items with restrict access', 'tainacan' )
|
||||||
|
],
|
||||||
|
'not_restrict' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items without restrict access', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_taxonomy_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-taxonomy";
|
||||||
|
$schema['properties']['list'] = [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'[tnc_tax_<ID>:string]' => [
|
||||||
|
'description' => __( 'Dynamic object, where the key is the taxonomy post type', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Taxonomy ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Taxonomy name', 'tainacan' )
|
||||||
|
],
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Object containing summary of terms totals', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total_terms' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of terms existing in the taxonomy', 'tainacan' )
|
||||||
|
],
|
||||||
|
'total_terms_used' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of terms that are used as value in some item taxonomy metadatum', 'tainacan' )
|
||||||
|
],
|
||||||
|
'total_terms_not_used' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of terms that are not used as value in any item taxonomy metadatum', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_taxonomy_terms_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-taxonomy-terms";
|
||||||
|
$schema['properties']['terms'] = [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Object containing summary of term usage numbers', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'[tnc_tax_<ID>:string]' => [
|
||||||
|
'description' => __( 'Dynamic object, where the key is the term id', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Term ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Term name', 'tainacan' )
|
||||||
|
],
|
||||||
|
'count' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items that use this term', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_summary_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-summary";
|
||||||
|
$schema['properties']['totals'] = [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Total of items', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Summation of the total of items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'trash' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of trashed items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'publish' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of published items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'draft' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of draft items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'private' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of private items', 'tainacan' )
|
||||||
|
],
|
||||||
|
'restrict' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items with restrict access', 'tainacan' )
|
||||||
|
],
|
||||||
|
'not_restrict' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items without restrict access', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'collections' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Total of collections', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Summation of the total of collections', 'tainacan' )
|
||||||
|
],
|
||||||
|
'trash' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of trashed collections', 'tainacan' )
|
||||||
|
],
|
||||||
|
'publish' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of published collections', 'tainacan' )
|
||||||
|
],
|
||||||
|
'private' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of private collections', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'taxonomies' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Total of taxonomies', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Summation of the total of taxonomies', 'tainacan' )
|
||||||
|
],
|
||||||
|
'trash' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of trashed taxonomies', 'tainacan' )
|
||||||
|
],
|
||||||
|
'publish' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of published taxonomies', 'tainacan' )
|
||||||
|
],
|
||||||
|
'private' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of private taxonomies', 'tainacan' )
|
||||||
|
],
|
||||||
|
'used' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of taxonomies used in some collection', 'tainacan' )
|
||||||
|
],
|
||||||
|
'not_used' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of taxonomies not used in any collection', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_activities_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-activities";
|
||||||
|
$schema['properties']['totals'] = [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'by_interval' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Total of activities by interval', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'start' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date-time',
|
||||||
|
'description' => __( 'Start date of the interval', 'tainacan' )
|
||||||
|
],
|
||||||
|
'end' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date-time',
|
||||||
|
'description' => __( 'End date of the interval', 'tainacan' )
|
||||||
|
],
|
||||||
|
'general' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'List of all activites per day, when there is any.', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Activity object', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'total' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Total of activities', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'date' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date',
|
||||||
|
'description' => __( 'Date of the activity', 'tainacan' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'by_user' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'Total of activities by user', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'User activity object', 'tainacan'),
|
||||||
|
'properties' => [
|
||||||
|
'user' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'User object', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'user_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'User ID', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of activities', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'by_date' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Activity by date object', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'user_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'User ID', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Total of activities', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'date' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date',
|
||||||
|
'description' => __( 'Date of the activity', 'tainacan' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'by_user' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'Total of activities by user', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'User activity object', 'tainacan'),
|
||||||
|
'properties' => [
|
||||||
|
'user' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'User object', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'user_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'User ID', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of activities', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'by_date' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Activity by date object', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'user_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'User ID', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'total' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Total of activities', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'date' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date',
|
||||||
|
'description' => __( 'Date of the activity', 'tainacan' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => [
|
||||||
|
'report_cached_on' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'format' => 'date-time',
|
||||||
|
'description' => __( 'Date of the last cache update', 'tainacan' )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
namespace Tainacan\API\EndPoints;
|
namespace Tainacan\API\EndPoints;
|
||||||
|
|
||||||
use \Tainacan\API\REST_Controller;
|
use \Tainacan\API\REST_Controller;
|
||||||
use Tainacan\Entities;
|
|
||||||
use Tainacan\Repositories;
|
|
||||||
|
|
||||||
class REST_Roles_Controller extends REST_Controller {
|
class REST_Roles_Controller extends REST_Controller {
|
||||||
|
|
||||||
|
@ -32,54 +30,34 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_items'),
|
'callback' => array($this, 'get_items'),
|
||||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||||
//'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
'args' => $this->get_endpoint_args(\WP_REST_Server::READABLE)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
'callback' => array($this, 'create_item'),
|
'callback' => array($this, 'create_item'),
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => $this->get_endpoint_args(\WP_REST_Server::CREATABLE)
|
||||||
'name' => array(
|
|
||||||
'description' => __('New role name', 'tainacan'),
|
|
||||||
'type' => 'string',
|
|
||||||
'required' => true
|
|
||||||
),
|
|
||||||
'capabilities' => array(
|
|
||||||
'description' => __('Array of capabilities, where the keys are capability slugs and values are booleans', 'tainacan'),
|
|
||||||
'required' => false,
|
|
||||||
'validate_callback' => [$this, 'validate_roles_capabilities_arg']
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
));
|
));
|
||||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<role>[a-z0-9-_]+)', array(
|
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<role>[a-z0-9-_]+)', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args(\WP_REST_Server::DELETABLE)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
'callback' => array($this, 'update_item'),
|
'callback' => array($this, 'update_item'),
|
||||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => $this->get_endpoint_args(\WP_REST_Server::EDITABLE)
|
||||||
'name' => array(
|
|
||||||
'description' => __('New role name', 'tainacan'),
|
|
||||||
'type' => 'string',
|
|
||||||
'required' => false
|
|
||||||
),
|
|
||||||
'capabilities' => array(
|
|
||||||
'description' => __('Array of capabilities, where the keys are capability slugs and values are booleans', 'tainacan'),
|
|
||||||
'required' => false,
|
|
||||||
'validate_callback' => [$this, 'validate_roles_capabilities_arg']
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args(\WP_REST_Server::READABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
));
|
));
|
||||||
|
@ -90,7 +68,15 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_capabilities'),
|
'callback' => array($this, 'get_capabilities'),
|
||||||
'permission_callback' => array($this, 'get_capabilities_permissions_check'),
|
'permission_callback' => array($this, 'get_capabilities_permissions_check'),
|
||||||
)
|
'args' => [
|
||||||
|
'collection_id' => [
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
),
|
||||||
|
'schema' => [$this, 'get_capabilities_schema']
|
||||||
));
|
));
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
$this->namespace, '/capabilities',
|
$this->namespace, '/capabilities',
|
||||||
|
@ -99,7 +85,8 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_capabilities'),
|
'callback' => array($this, 'get_capabilities'),
|
||||||
'permission_callback' => array($this, 'get_capabilities_permissions_check'),
|
'permission_callback' => array($this, 'get_capabilities_permissions_check'),
|
||||||
)
|
),
|
||||||
|
'schema' => [$this, 'get_capabilities_schema']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,8 +227,6 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$role = $roles[$role_slug];
|
|
||||||
|
|
||||||
if ( isset($request['name']) ) {
|
if ( isset($request['name']) ) {
|
||||||
|
|
||||||
$name = esc_html( esc_sql( $request['name'] ) );
|
$name = esc_html( esc_sql( $request['name'] ) );
|
||||||
|
@ -470,6 +455,56 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function get_endpoint_args( $method = null ) {
|
||||||
|
$endpoint_args = [];
|
||||||
|
|
||||||
|
switch ( $method ) {
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$endpoint_args['role'] = array(
|
||||||
|
'description' => __( 'Role slug', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => true
|
||||||
|
);
|
||||||
|
$endpoint_args['add_cap'] = array(
|
||||||
|
'description' => __( 'the capability slug to be add', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => false
|
||||||
|
);
|
||||||
|
$endpoint_args['remove_cap'] = array(
|
||||||
|
'description' => __( 'The capability slug to be removed', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => false
|
||||||
|
);
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
$endpoint_args['name'] = array(
|
||||||
|
'description' => __('New role name', 'tainacan'),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => $method == \WP_REST_Server::CREATABLE
|
||||||
|
);
|
||||||
|
$endpoint_args['capabilities'] = array(
|
||||||
|
'description' => __('Array of capabilities, where the keys are capability slugs and values are booleans', 'tainacan'),
|
||||||
|
'required' => false,
|
||||||
|
'validate_callback' => [$this, 'validate_roles_capabilities_arg']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::READABLE:
|
||||||
|
case \WP_REST_Server::DELETABLE:
|
||||||
|
$endpoint_args['role'] = array(
|
||||||
|
'description' => __( 'Role slug', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'required' => $method == \WP_REST_Server::DELETABLE
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $endpoint_args;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \WP_REST_Request $request
|
* @param \WP_REST_Request $request
|
||||||
*
|
*
|
||||||
|
@ -540,17 +575,114 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_capabilities_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => "$this->rest_base-capabilities",
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => [
|
||||||
|
'capabilities' => [
|
||||||
|
'description' => __( 'Capabilities for the user role.', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'[capability]:string' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'description' => __( 'Capability object', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'display_name' => [
|
||||||
|
'description' => __( 'Display name for the capability.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'description' => __( 'Description for the capability.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'scope' => [
|
||||||
|
'description' => __( 'Scope for the capability.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'enum' => [ 'repository', 'collection' ]
|
||||||
|
],
|
||||||
|
'superpcaps' => [
|
||||||
|
'description' => __( 'Super capabilities that have precendence over this capability.', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'string'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'roles' => [
|
||||||
|
'description' => __( 'Roles that have this capability.', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'slug' => [
|
||||||
|
'description' => __( 'Slug for the role.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'description' => __( 'Display name for the role.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'roles_inherit' => [
|
||||||
|
'description' => __( 'Roles that inherit this capability.', 'tainacan' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'slug' => [
|
||||||
|
'description' => __( 'Slug for the role.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'description' => __( 'Display name for the role.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
function get_schema() {
|
function get_schema() {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'filter',
|
'title' => $this->rest_base,
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ],
|
||||||
|
'properties' => [
|
||||||
|
'slug' => [
|
||||||
|
'description' => __( 'Unique identifier for the user role.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'description' => __( 'Display name for the user role.', 'tainacan' ),
|
||||||
|
'type' => 'string'
|
||||||
|
],
|
||||||
|
'capabilities' => [
|
||||||
|
'description' => __( 'Capabilities for the user role.', 'tainacan' ),
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'[capability]:string' => [
|
||||||
|
'type' => 'boolean',
|
||||||
|
'description' => __( 'Whether the role has the given capability.', 'tainacan' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -5,10 +5,12 @@ namespace Tainacan\API\EndPoints;
|
||||||
use \Tainacan\API\REST_Controller;
|
use \Tainacan\API\REST_Controller;
|
||||||
use Tainacan\Entities;
|
use Tainacan\Entities;
|
||||||
use Tainacan\Repositories;
|
use Tainacan\Repositories;
|
||||||
use Tainacan\Entities\Entity;
|
|
||||||
|
|
||||||
class REST_Sequence_Edit_Controller extends REST_Controller {
|
class REST_Sequence_Edit_Controller extends REST_Controller {
|
||||||
|
|
||||||
|
private $items_repository;
|
||||||
|
private $collections_repository;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->rest_base = 'sequence-edit';
|
$this->rest_base = 'sequence-edit';
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -34,6 +36,7 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
|
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
|
||||||
'args' => $this->get_create_params()
|
'args' => $this->get_create_params()
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_sequence_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)',
|
||||||
|
@ -42,7 +45,9 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
|
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
|
||||||
|
'args' => $this->get_sequence_params()
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_sequence_index_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/(?P<sequence_index>[\d]+)',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/(?P<sequence_index>[\d]+)',
|
||||||
|
@ -51,7 +56,9 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'get_item_in_sequence'),
|
'callback' => array($this, 'get_item_in_sequence'),
|
||||||
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
|
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
|
||||||
|
'args' => $this->get_sequence_params()
|
||||||
),
|
),
|
||||||
|
'schema' => [$this, 'get_sequence_index_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -185,6 +192,11 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function get_create_params($object_name = null) {
|
public function get_create_params($object_name = null) {
|
||||||
|
|
||||||
|
$query_params['collection_id'] = [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
];
|
||||||
|
|
||||||
$query_params['items_ids'] = [
|
$query_params['items_ids'] = [
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'items' => ['type' => 'integer'],
|
'items' => ['type' => 'integer'],
|
||||||
|
@ -199,6 +211,71 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
|
||||||
return $query_params;
|
return $query_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
public function get_sequence_params() {
|
||||||
|
$endpoint_args = [
|
||||||
|
'collection_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'group_id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Group ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'sequence_index' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Sequence index', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return $endpoint_args;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sequence_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-sequence";
|
||||||
|
$schema['properties'] = [
|
||||||
|
'id' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Bulk edition processs ID', 'tainacan' )
|
||||||
|
],
|
||||||
|
'items_count' => [
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __( 'Total of items selected for the sequence edit.', 'tainacan' ),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sequence_index_schema() {
|
||||||
|
$schema = $this->get_schema();
|
||||||
|
$schema['title'] = "$this->rest_base-sequence-index";
|
||||||
|
$schema['type'] = 'integer';
|
||||||
|
$schema['description'] = __( 'Item ID in the current sequence index', 'tainacan' );
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_schema() {
|
||||||
|
$schema = [
|
||||||
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
|
'title' => $this->rest_base,
|
||||||
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -25,7 +25,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
public function init_objects() {
|
public function init_objects() {
|
||||||
$this->taxonomy = new Entities\Taxonomy();
|
$this->taxonomy = new Entities\Taxonomy();
|
||||||
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
|
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
|
||||||
$this->collections_repository = Repositories\Collections::get_instance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register_routes() {
|
public function register_routes() {
|
||||||
|
@ -44,7 +43,7 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
|
@ -55,6 +54,10 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => array(
|
'args' => array(
|
||||||
|
'taxonomy_id' => array(
|
||||||
|
'description' => __( 'Taxonomy ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
'context' => array(
|
'context' => array(
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => 'view',
|
'default' => 'view',
|
||||||
|
@ -64,21 +67,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
'edit'
|
'edit'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'fetch_only' => array(
|
|
||||||
'type' => ['string', 'array'],
|
|
||||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.', 'tainacan' ),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
|
||||||
'callback' => array($this, 'delete_item'),
|
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
|
||||||
'args' => array(
|
|
||||||
'permanently' => array(
|
|
||||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
|
||||||
'default' => '0',
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -87,6 +75,12 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
|
'callback' => array($this, 'delete_item'),
|
||||||
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE)
|
||||||
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -97,7 +91,15 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
'callback' => array($this, 'update_item'),
|
'callback' => array($this, 'update_item'),
|
||||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'collection_id' => array(
|
||||||
|
'description' => __( 'Collection ID', 'tainacan' ),
|
||||||
|
'required' => true,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
$this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
|
@ -497,26 +499,62 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
'taxonomy_id' => [
|
||||||
$endpoint_args = array_merge(
|
'description' => __( 'Taxonomy ID', 'tainacan' ),
|
||||||
$endpoint_args,
|
'required' => true,
|
||||||
parent::get_wp_query_params(),
|
]
|
||||||
parent::get_fetch_only_param()
|
];
|
||||||
);
|
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
switch ( $method ) {
|
||||||
$map = $this->taxonomy_repository->get_map();
|
case \WP_REST_Server::READABLE:
|
||||||
|
|
||||||
foreach ($map as $mapped => $value){
|
$endpoint_args['fetch_only'] = array(
|
||||||
$set_ = 'set_'. $mapped;
|
'type' => ['string', 'array'],
|
||||||
|
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.', 'tainacan' ),
|
||||||
|
);
|
||||||
|
$endpoint_args['context'] = array(
|
||||||
|
'description' => __( 'Scope under which the request is made; determines fields present in response.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => 'view',
|
||||||
|
'enum' => array(
|
||||||
|
'view',
|
||||||
|
'edit',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params(),
|
||||||
|
parent::get_fetch_only_param()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
$map = $this->taxonomy_repository->get_map();
|
||||||
|
|
||||||
// Show only args that has a method set
|
foreach ($map as $mapped => $value){
|
||||||
if( !method_exists($this->taxonomy, "$set_") ){
|
$set_ = 'set_'. $mapped;
|
||||||
unset($map[$mapped]);
|
|
||||||
|
// Show only args that has a method set
|
||||||
|
if( !method_exists($this->taxonomy, "$set_") ){
|
||||||
|
unset($map[$mapped]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$endpoint_args = $map;
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
$map
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $method === \WP_REST_Server::CREATABLE )
|
||||||
|
unset($endpoint_args['taxonomy_id']);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::DELETABLE:
|
||||||
|
$endpoint_args['permanently'] = array(
|
||||||
|
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||||
|
'default' => '0',
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -549,7 +587,8 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'taxonomy',
|
'title' => 'taxonomy',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ]
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->taxonomy_repository );
|
$main_schema = parent::get_repository_schema( $this->taxonomy_repository );
|
||||||
|
@ -562,7 +601,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/taxonomy/(?P<taxonomy_id>[\d]+)/' . $this->rest_base,
|
register_rest_route($this->namespace, '/taxonomy/(?P<taxonomy_id>[\d]+)/' . $this->rest_base,
|
||||||
|
@ -63,25 +63,27 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'delete_items_permissions_check'),
|
'permission_callback' => array($this, 'delete_items_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params()
|
'args' => $this->get_wp_query_params()
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace,'/taxonomy/(?P<taxonomy_id>[\d]+)/'. $this->rest_base . '/(?P<term_id>[\d]+)' ,
|
register_rest_route($this->namespace,'/taxonomy/(?P<taxonomy_id>[\d]+)/'. $this->rest_base . '/(?P<term_id>[\d]+)' ,
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::DELETABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array($this, 'delete_item'),
|
'callback' => array($this, 'get_item'),
|
||||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||||
'args' => [
|
'args' => array(
|
||||||
'permanently' => [
|
'taxonomy_id' => array(
|
||||||
'description' => __('Delete term permanently.'),
|
'description' => __( 'Taxonomy ID', 'tainacan' ),
|
||||||
'default' => '1'
|
'required' => true,
|
||||||
],
|
'type' => ['integer', 'string'],
|
||||||
'delete_child_terms' => [
|
),
|
||||||
'description' => __('Delete all child terms.'),
|
'term_id' => array(
|
||||||
'default' => false
|
'description' => __( 'Term ID', 'tainacan' ),
|
||||||
],
|
'type' => ['integer', 'string'],
|
||||||
]
|
'required' => true,
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
|
@ -90,10 +92,10 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::DELETABLE,
|
||||||
'callback' => array($this, 'get_item'),
|
'callback' => array($this, 'delete_item'),
|
||||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_schema']
|
||||||
)
|
)
|
||||||
|
@ -104,9 +106,18 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
'methods' => \WP_REST_Server::EDITABLE,
|
'methods' => \WP_REST_Server::EDITABLE,
|
||||||
'callback' => array($this, 'update_parent_terms'),
|
'callback' => array($this, 'update_parent_terms'),
|
||||||
'permission_callback' => array($this, 'update_parent_terms_permissions_check'),
|
'permission_callback' => array($this, 'update_parent_terms_permissions_check'),
|
||||||
'args' => $this->get_wp_query_params()
|
'args' => array_merge(
|
||||||
|
array(
|
||||||
|
'new_parent_id' => array(
|
||||||
|
'description' => __('The new parent term ID.'),
|
||||||
|
'type' => ['integer', 'string'],
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->get_wp_query_params()
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'schema' => [$this, 'get_schema']
|
'schema' => [$this, 'get_list_schema']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -662,39 +673,71 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||||
$endpoint_args = [];
|
$endpoint_args = [
|
||||||
if($method === \WP_REST_Server::READABLE) {
|
'taxonomy_id' => [
|
||||||
$endpoint_args = array_merge(
|
'description' => __( 'Taxonomy ID', 'tainacan' ),
|
||||||
$endpoint_args,
|
'required' => true,
|
||||||
parent::get_wp_query_params()
|
'type' => ['integer', 'string'],
|
||||||
);
|
],
|
||||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
'term_id' => [
|
||||||
$map = $this->terms_repository->get_map();
|
'description' => __( 'Term ID', 'tainacan' ),
|
||||||
|
'type' => ['integer', 'string'],
|
||||||
|
'required' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($map as $mapped => $value){
|
switch ( $method ) {
|
||||||
$set_ = 'set_'. $mapped;
|
case \WP_REST_Server::READABLE:
|
||||||
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
parent::get_wp_query_params()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::CREATABLE:
|
||||||
|
case \WP_REST_Server::EDITABLE:
|
||||||
|
|
||||||
// Show only args that has a method set
|
$map = $this->terms_repository->get_map();
|
||||||
if( !method_exists($this->term, "$set_") ){
|
|
||||||
unset($map[$mapped]);
|
foreach ($map as $mapped => $value){
|
||||||
|
$set_ = 'set_'. $mapped;
|
||||||
|
|
||||||
|
// Show only args that has a method set
|
||||||
|
if( !method_exists($this->term, "$set_") ){
|
||||||
|
unset($map[$mapped]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$endpoint_args = $map;
|
$endpoint_args = array_merge(
|
||||||
|
$endpoint_args,
|
||||||
|
$map
|
||||||
|
);
|
||||||
|
|
||||||
if ($method === \WP_REST_Server::CREATABLE) {
|
if ( $method === \WP_REST_Server::CREATABLE ) {
|
||||||
$endpoint_args['metadatum_id'] = [
|
|
||||||
'required' => false,
|
unset($endpoint_args['term_id']);
|
||||||
'type' => 'integer',
|
|
||||||
'description' => __('If term is being created in the context of a Taxonomy metadatum, specify its ID')
|
$endpoint_args['metadatum_id'] = [
|
||||||
|
'required' => false,
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __('If term is being created in the context of a Taxonomy metadatum, specify its ID')
|
||||||
|
];
|
||||||
|
$endpoint_args['item_id'] = [
|
||||||
|
'required' => false,
|
||||||
|
'type' => 'integer',
|
||||||
|
'description' => __('If term is being created in the context of a Taxonomy metadatum, specify the ID of the item being edited')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case \WP_REST_Server::DELETABLE:
|
||||||
|
$endpoint_args['permanently'] = [
|
||||||
|
'description' => __('Delete term permanently.'),
|
||||||
|
'default' => '1'
|
||||||
];
|
];
|
||||||
$endpoint_args['item_id'] = [
|
$endpoint_args['delete_child_terms'] = [
|
||||||
'required' => false,
|
'description' => __('Delete all child terms.'),
|
||||||
'type' => 'integer',
|
'default' => false
|
||||||
'description' => __('If term is being created in the context of a Taxonomy metadatum, specify the ID of the item being edited')
|
|
||||||
];
|
];
|
||||||
}
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endpoint_args;
|
return $endpoint_args;
|
||||||
|
@ -709,6 +752,12 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_wp_query_params() {
|
public function get_wp_query_params() {
|
||||||
|
$query_params['taxonomy_id'] = array(
|
||||||
|
'description' => __('Taxonomy ID.'),
|
||||||
|
'type' => ['integer', 'string'],
|
||||||
|
'required' => true
|
||||||
|
);
|
||||||
|
|
||||||
$query_params['context']['default'] = 'view';
|
$query_params['context']['default'] = 'view';
|
||||||
|
|
||||||
$query_params = array_merge($query_params, parent::get_wp_query_params());
|
$query_params = array_merge($query_params, parent::get_wp_query_params());
|
||||||
|
@ -727,19 +776,17 @@ class REST_Terms_Controller extends REST_Controller {
|
||||||
$schema = [
|
$schema = [
|
||||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||||
'title' => 'term',
|
'title' => 'term',
|
||||||
'type' => 'object'
|
'type' => 'object',
|
||||||
|
'tags' => [ $this->rest_base ]
|
||||||
];
|
];
|
||||||
|
|
||||||
$main_schema = parent::get_repository_schema( $this->terms_repository );
|
$main_schema = parent::get_repository_schema( $this->terms_repository );
|
||||||
$permissions_schema = parent::get_permissions_schema();
|
$permissions_schema = parent::get_permissions_schema();
|
||||||
|
|
||||||
// $taxonomy_scheme = parent::get_repository_schema( $this->taxonomy_repository );
|
|
||||||
|
|
||||||
$schema['properties'] = array_merge(
|
$schema['properties'] = array_merge(
|
||||||
parent::get_base_properties_schema(),
|
parent::get_base_properties_schema(),
|
||||||
$main_schema,
|
$main_schema,
|
||||||
$permissions_schema
|
$permissions_schema
|
||||||
// $taxonomy_scheme
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base namespace for all rest api requests. WordPress default is 'wp/v2'.
|
||||||
|
*/
|
||||||
const TAINACAN_REST_NAMESPACE = 'tainacan/v2';
|
const TAINACAN_REST_NAMESPACE = 'tainacan/v2';
|
||||||
|
|
||||||
//$rest_controller = new \Tainacan\API\REST_Controller();
|
/**
|
||||||
|
* Tainacan REST APIs initialization.
|
||||||
|
*/
|
||||||
$rest_items_controller = new \Tainacan\API\EndPoints\REST_Items_Controller();
|
$rest_items_controller = new \Tainacan\API\EndPoints\REST_Items_Controller();
|
||||||
$rest_terms_controller = new \Tainacan\API\EndPoints\REST_Terms_Controller();
|
$rest_terms_controller = new \Tainacan\API\EndPoints\REST_Terms_Controller();
|
||||||
$rest_logs_controller = new \Tainacan\API\EndPoints\REST_Logs_Controller();
|
$rest_logs_controller = new \Tainacan\API\EndPoints\REST_Logs_Controller();
|
||||||
|
|
|
@ -14,7 +14,6 @@ class Filter extends Entity {
|
||||||
$name,
|
$name,
|
||||||
$description,
|
$description,
|
||||||
$order,
|
$order,
|
||||||
$color,
|
|
||||||
$metadatum,
|
$metadatum,
|
||||||
$metadatum_id,
|
$metadatum_id,
|
||||||
$max_options,
|
$max_options,
|
||||||
|
@ -85,14 +84,6 @@ class Filter extends Entity {
|
||||||
return $this->get_mapped_property('order');
|
return $this->get_mapped_property('order');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the filter color
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function get_color() {
|
|
||||||
return $this->get_mapped_property('color');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return max number of options to be showed
|
* Return max number of options to be showed
|
||||||
|
@ -219,16 +210,6 @@ class Filter extends Entity {
|
||||||
$this->set_mapped_property('description', $value);
|
$this->set_mapped_property('description', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the filter color
|
|
||||||
*
|
|
||||||
* @param [string] $value
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function set_color( $value ) {
|
|
||||||
$this->set_mapped_property('parent', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the filter metadatum passing an object
|
* Define the filter metadatum passing an object
|
||||||
*
|
*
|
||||||
|
|
|
@ -765,9 +765,11 @@ class Item extends Entity {
|
||||||
$before = str_replace('$id', ' id="metadata-id-' . $item_metadatum->get_metadatum()->get_id() . '"', $before);
|
$before = str_replace('$id', ' id="metadata-id-' . $item_metadatum->get_metadatum()->get_id() . '"', $before);
|
||||||
|
|
||||||
// Let theme authors tweak the wrapper opener
|
// Let theme authors tweak the wrapper opener
|
||||||
|
$metadata_type = $item_metadatum->get_metadatum()->get_metadata_type();
|
||||||
|
$metadatum_id = $item_metadatum->get_metadatum()->get_id();
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before', $before, $item_metadatum );
|
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before', $before, $item_metadatum );
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before--type-' . $item_metadatum->get_metadatum()->get_metadata_type(), $before, $item_metadatum );
|
$before = apply_filters( "tainacan-get-item-metadatum-as-html-before--type-$metadata_type", $before, $item_metadatum );
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before--id-' . $item_metadatum->get_metadatum()->get_id(), $before, $item_metadatum );
|
$before = apply_filters( "tainacan-get-item-metadatum-as-html-before--id-$metadatum_id", $before, $item_metadatum );
|
||||||
if ( is_numeric($metadatum_index) ) {
|
if ( is_numeric($metadatum_index) ) {
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before--index-' . $metadatum_index, $before, $item_metadatum );
|
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before--index-' . $metadatum_index, $before, $item_metadatum );
|
||||||
}
|
}
|
||||||
|
@ -795,8 +797,10 @@ class Item extends Entity {
|
||||||
if ( is_numeric($metadatum_index) ) {
|
if ( is_numeric($metadatum_index) ) {
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--index-' . $metadatum_index, $after, $item_metadatum );
|
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--index-' . $metadatum_index, $after, $item_metadatum );
|
||||||
}
|
}
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--id-' . $item_metadatum->get_metadatum()->get_id(), $after, $item_metadatum );
|
$metadata_type = $item_metadatum->get_metadatum()->get_metadata_type();
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--type-' . $item_metadatum->get_metadatum()->get_metadata_type(), $after, $item_metadatum );
|
$metadatum_id = $item_metadatum->get_metadatum()->get_id();
|
||||||
|
$after = apply_filters( "tainacan-get-item-metadatum-as-html-after--id-$metadatum_id", $after, $item_metadatum );
|
||||||
|
$after = apply_filters( "tainacan-get-item-metadatum-as-html-after--type-$metadata_type", $after, $item_metadatum );
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after', $after, $item_metadatum );
|
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after', $after, $item_metadatum );
|
||||||
|
|
||||||
// Closes the wrapper
|
// Closes the wrapper
|
||||||
|
|
|
@ -21,7 +21,6 @@ class Metadatum extends Entity {
|
||||||
$display,
|
$display,
|
||||||
$cardinality,
|
$cardinality,
|
||||||
$collection_key,
|
$collection_key,
|
||||||
$mask,
|
|
||||||
$default_value,
|
$default_value,
|
||||||
$metadata_type,
|
$metadata_type,
|
||||||
$metadata_type_options,
|
$metadata_type_options,
|
||||||
|
@ -168,15 +167,6 @@ class Metadatum extends Entity {
|
||||||
return $this->get_mapped_property('collection_key');
|
return $this->get_mapped_property('collection_key');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the mask
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function get_mask(){
|
|
||||||
return $this->get_mapped_property('mask');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the metadatum default value
|
* Return the metadatum default value
|
||||||
*
|
*
|
||||||
|
@ -381,15 +371,6 @@ class Metadatum extends Entity {
|
||||||
$this->set_mapped_property('collection_key', $value);
|
$this->set_mapped_property('collection_key', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set mask for the metadatum
|
|
||||||
*
|
|
||||||
* @param [string] $value
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function set_mask( $value ){
|
|
||||||
$this->set_mapped_property('mask', $value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set default value
|
* Set default value
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Tainacan;
|
namespace Tainacan;
|
||||||
|
|
||||||
use Tainacan\Mappers_Hanlder;
|
use Tainacan\Mappers_Handler;
|
||||||
use Tainacan\Mappers\Mapper;
|
use Tainacan\Mappers\Mapper;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
|
|
|
@ -27,54 +27,55 @@ class Collections extends Repository {
|
||||||
* @see \Tainacan\Repositories\Repository::get_map()
|
* @see \Tainacan\Repositories\Repository::get_map()
|
||||||
*/
|
*/
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
'name' => [
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
|
'name' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Name', 'tainacan' ),
|
'title' => __( 'Name', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The title of the collection', 'tainacan' ),
|
'description' => __( 'The title of the collection', 'tainacan' ),
|
||||||
'validation' => v::stringType()->notEmpty(),
|
'validation' => v::stringType()->notEmpty(),
|
||||||
],
|
],
|
||||||
'status' => [
|
'status' => [
|
||||||
'map' => 'post_status',
|
'map' => 'post_status',
|
||||||
'title' => __( 'Status', 'tainacan' ),
|
'title' => __( 'Status', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'description' => __( 'The current situation of the collection. It also affects the visibility of the collection items, as public items from private collections do not appear in the site.', 'tainacan' )
|
'description' => __( 'The current situation of the collection. It also affects the visibility of the collection items, as public items from private collections do not appear in the site.', 'tainacan' )
|
||||||
],
|
],
|
||||||
'author_id' => [
|
'author_id' => [
|
||||||
'map' => 'post_author',
|
'map' => 'post_author',
|
||||||
'title' => __( 'Author ID', 'tainacan' ),
|
'title' => __( 'Author ID', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The collection author\'s user ID (numeric string)', 'tainacan' )
|
'description' => __( 'The collection author\'s user ID (numeric string)', 'tainacan' )
|
||||||
],
|
],
|
||||||
'creation_date' => [
|
'creation_date' => [
|
||||||
'map' => 'post_date',
|
'map' => 'post_date',
|
||||||
'title' => __( 'Creation Date', 'tainacan' ),
|
'title' => __( 'Creation Date', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The collection creation date', 'tainacan' )
|
'description' => __( 'The collection creation date', 'tainacan' )
|
||||||
],
|
],
|
||||||
'modification_date' => [
|
'modification_date' => [
|
||||||
'map' => 'post_modified',
|
'map' => 'post_modified',
|
||||||
'title' => __( 'Modification Date', 'tainacan' ),
|
'title' => __( 'Modification Date', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The collection modification date', 'tainacan' )
|
'description' => __( 'The collection modification date', 'tainacan' )
|
||||||
],
|
],
|
||||||
'order' => [
|
'order' => [
|
||||||
'map' => 'order',
|
'map' => 'order',
|
||||||
'title' => __( 'Order', 'tainacan' ),
|
'title' => __( 'Order', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Collection order. This metadata is used if collections are manually ordered.', 'tainacan' ),
|
'description' => __( 'Collection order. This metadata is used if collections are manually ordered.', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'parent' => [
|
'parent' => [
|
||||||
'map' => 'post_parent',
|
'map' => 'post_parent',
|
||||||
'title' => __( 'Parent Collection', 'tainacan' ),
|
'title' => __( 'Parent Collection', 'tainacan' ),
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'description' => __( 'Original collection from which features are inherited', 'tainacan' ),
|
'description' => __( 'Original collection from which features are inherited', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
'map' => 'post_content',
|
'map' => 'post_content',
|
||||||
'title' => __( 'Description', 'tainacan' ),
|
'title' => __( 'Description', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
@ -82,14 +83,14 @@ class Collections extends Repository {
|
||||||
'default' => '',
|
'default' => '',
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'slug' => [
|
'slug' => [
|
||||||
'map' => 'post_name',
|
'map' => 'post_name',
|
||||||
'title' => __( 'Slug', 'tainacan' ),
|
'title' => __( 'Slug', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'An unique and sanitized string representation of the collection, used to build the collection URL. It must not contain any special characters or spaces.', 'tainacan' ),
|
'description' => __( 'An unique and sanitized string representation of the collection, used to build the collection URL. It must not contain any special characters or spaces.', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'default_orderby' => [
|
'default_orderby' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default order metadata', 'tainacan' ),
|
'title' => __( 'Default order metadata', 'tainacan' ),
|
||||||
'type' => ['string', 'array', 'object'],
|
'type' => ['string', 'array', 'object'],
|
||||||
|
@ -97,12 +98,13 @@ class Collections extends Repository {
|
||||||
'default' => 'date',
|
'default' => 'date',
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'default_order' => [
|
'default_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default order', 'tainacan' ),
|
'title' => __( 'Default order', 'tainacan' ),
|
||||||
'description' => __( 'Default order for items in this collection. ASC or DESC', 'tainacan' ),
|
'description' => __( 'Default order for items in this collection. ASC or DESC', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => 'ASC',
|
'default' => 'ASC',
|
||||||
|
'enum' => [ 'ASC', 'DESC' ],
|
||||||
'validation' => v::stringType()->in( [ 'ASC', 'DESC' ] ),
|
'validation' => v::stringType()->in( [ 'ASC', 'DESC' ] ),
|
||||||
],
|
],
|
||||||
'default_displayed_metadata' => [
|
'default_displayed_metadata' => [
|
||||||
|
@ -114,7 +116,7 @@ class Collections extends Repository {
|
||||||
'description' => __( 'List of collection properties that will be displayed in the table view', 'tainacan' ),
|
'description' => __( 'List of collection properties that will be displayed in the table view', 'tainacan' ),
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'default_view_mode' => [
|
'default_view_mode' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default view mode', 'tainacan' ),
|
'title' => __( 'Default view mode', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
@ -122,7 +124,7 @@ class Collections extends Repository {
|
||||||
'default' => 'table',
|
'default' => 'table',
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'enabled_view_modes' => [
|
'enabled_view_modes' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Enabled view modes', 'tainacan' ),
|
'title' => __( 'Enabled view modes', 'tainacan' ),
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
|
@ -131,27 +133,81 @@ class Collections extends Repository {
|
||||||
'items' => [ 'type' => 'string' ],
|
'items' => [ 'type' => 'string' ],
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'metadata_section_order' => [
|
'metadata_section_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Metadata order', 'tainacan' ),
|
'title' => __( 'Metadata order', 'tainacan' ),
|
||||||
'type' => ['array', 'object', 'string'],
|
'type' => 'array',
|
||||||
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Metadata Section ID', 'tainacan' ),
|
||||||
|
'type' => ['integer', 'string'],
|
||||||
|
],
|
||||||
|
'enabled' => [
|
||||||
|
'description' => __( 'Whether the metadata section is enabled or not.', 'tainacan' ),
|
||||||
|
'type' => 'boolean',
|
||||||
|
],
|
||||||
|
'metadata_order' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'description' => __( 'Array containing the metadata order inside the section', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Metadata ID', 'tainacan' ),
|
||||||
|
'type' => 'integer'
|
||||||
|
],
|
||||||
|
'enabled' => [
|
||||||
|
'description' => __( 'Whether the metadata is enabled or not.', 'tainacan' ),
|
||||||
|
'type' => 'boolean'
|
||||||
|
]
|
||||||
|
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
'description' => __( 'The order of the metadata section in the collection', 'tainacan' ),
|
'description' => __( 'The order of the metadata section in the collection', 'tainacan' ),
|
||||||
],
|
],
|
||||||
'metadata_order' => [
|
'metadata_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Metadata order', 'tainacan' ),
|
'title' => __( 'Metadata order', 'tainacan' ),
|
||||||
'type' => ['array', 'object', 'string'],
|
'type' => 'array',
|
||||||
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
|
||||||
'description' => __( 'The order of the metadata in the collection', 'tainacan' ),
|
'description' => __( 'The order of the metadata in the collection', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Metadata ID', 'tainacan' ),
|
||||||
|
'type' => 'integer'
|
||||||
|
],
|
||||||
|
'enabled' => [
|
||||||
|
'description' => __( 'Whether the metadata is enabled or not.', 'tainacan' ),
|
||||||
|
'type' => 'boolean'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'filters_order' => [
|
'filters_order' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Filters order', 'tainacan' ),
|
'title' => __( 'Filters order', 'tainacan' ),
|
||||||
'type' => ['array', 'object', 'string'],
|
'type' => 'array',
|
||||||
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
|
||||||
'description' => __( 'The order of the filters in the collection', 'tainacan' ),
|
'description' => __( 'The order of the filters in the collection', 'tainacan' ),
|
||||||
|
'items' => [
|
||||||
|
'type' => 'object',
|
||||||
|
'properties' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Filter ID', 'tainacan' ),
|
||||||
|
'type' => 'integer'
|
||||||
|
],
|
||||||
|
'enabled' => [
|
||||||
|
'description' => __( 'Whether the filter is enabled or not.', 'tainacan' ),
|
||||||
|
'type' => 'boolean'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
//'validation' => v::stringType(),
|
//'validation' => v::stringType(),
|
||||||
],
|
],
|
||||||
'enable_cover_page' => [
|
'enable_cover_page' => [
|
||||||
|
@ -160,6 +216,7 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'To use this page as the home page of this collection', 'tainacan' ),
|
'description' => __( 'To use this page as the home page of this collection', 'tainacan' ),
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
|
@ -184,7 +241,8 @@ class Collections extends Repository {
|
||||||
'_thumbnail_id' => [
|
'_thumbnail_id' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Thumbnail', 'tainacan' ),
|
'title' => __( 'Thumbnail', 'tainacan' ),
|
||||||
'description' => __( 'Squared reduced-size version of a picture that helps recognizing and organizing files', 'tainacan' )
|
'description' => __( 'Squared reduced-size version of a picture that helps recognizing and organizing files', 'tainacan' ),
|
||||||
|
'type' => ['integer', 'string'],
|
||||||
],
|
],
|
||||||
'comment_status' => [
|
'comment_status' => [
|
||||||
'map' => 'comment_status',
|
'map' => 'comment_status',
|
||||||
|
@ -192,7 +250,8 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Collection comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
'description' => __( 'Collection comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
||||||
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
|
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
|
||||||
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
'enum' => [ 'open', 'closed' ],
|
||||||
|
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
||||||
],
|
],
|
||||||
'allow_comments' => [
|
'allow_comments' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
|
@ -200,30 +259,33 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If this option is enabled, items of this collection can be set to enable a comments section on their page. "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
'description' => __( 'If this option is enabled, items of this collection can be set to enable a comments section on their page. "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
||||||
'default' => 'closed',
|
'default' => 'closed',
|
||||||
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
'enum' => [ 'open', 'closed' ],
|
||||||
|
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
||||||
],
|
],
|
||||||
'submission_anonymous_user' => [
|
'submission_anonymous_user' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
|
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If enabled, allows submission by anonymous users, whose does not have to be logged in with permissions on the WordPress system.', 'tainacan' ),
|
'description' => __( 'If enabled, allows submission by anonymous users, whose does not have to be logged in with permissions on the WordPress system.', 'tainacan' ),
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
],
|
],
|
||||||
'submission_default_status' => [
|
'submission_default_status' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default submission item status', 'tainacan' ),
|
'title' => __( 'Default submission item status', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The default status of the item that will be created in the collection after submission.', 'tainacan' ),
|
'description' => __( 'The default status of the item that will be created in the collection after submission.', 'tainacan' ),
|
||||||
'default' => 'draft'
|
'default' => 'draft'
|
||||||
],
|
],
|
||||||
'allows_submission' => [
|
'allows_submission' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Allows item submission', 'tainacan' ),
|
'title' => __( 'Allows item submission', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If enabled, the collection allows item submission, for example via the Item Submission block.', 'tainacan' ),
|
'description' => __( 'If enabled, the collection allows item submission, for example via the Item Submission block.', 'tainacan' ),
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
],
|
],
|
||||||
|
@ -233,24 +295,40 @@ class Collections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Enable this option to never display the item thumbnail on the items list. This is ment for collections made of mainly textual content.', 'tainacan' ),
|
'description' => __( 'Enable this option to never display the item thumbnail on the items list. This is ment for collections made of mainly textual content.', 'tainacan' ),
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'submission_use_recaptcha' => [
|
'submission_use_recaptcha' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Use reCAPTCHA verification on submission form', 'tainacan' ),
|
'title' => __( 'Use reCAPTCHA verification on submission form', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'If enabled, the collection allows item submission using a reCAPTCHA', 'tainacan' ),
|
'description' => __( 'If enabled, the collection allows item submission using a reCAPTCHA', 'tainacan' ),
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
],
|
],
|
||||||
'default_metadata_section_properties' => [
|
'default_metadata_section_properties' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default metadata section properties', 'tainacan' ),
|
'title' => __( 'Default metadata section properties', 'tainacan' ),
|
||||||
'type' => 'object',
|
'type' => 'object',
|
||||||
'items' => [ 'name' => 'string', 'description' => 'string', 'description_bellow_name' => 'string' ],
|
|
||||||
'description' => __( 'The default metadata section properties', 'tainacan' ),
|
'description' => __( 'The default metadata section properties', 'tainacan' ),
|
||||||
|
'properties' => [
|
||||||
|
'name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The name of the default metadata section', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The description of the default metadata section', 'tainacan' ),
|
||||||
|
],
|
||||||
|
'description_bellow_name' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'Whether the description should appear bellow the metadata section.', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ]
|
||||||
|
]
|
||||||
|
]
|
||||||
],
|
],
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,8 @@ class Filters extends Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
'name' => [
|
'name' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Name', 'tainacan' ),
|
'title' => __( 'Name', 'tainacan' ),
|
||||||
|
@ -41,7 +42,7 @@ class Filters extends Repository {
|
||||||
'order' => [
|
'order' => [
|
||||||
'map' => 'menu_order',
|
'map' => 'menu_order',
|
||||||
'title' => __( 'Order', 'tainacan' ),
|
'title' => __( 'Order', 'tainacan' ),
|
||||||
'type' => 'string/integer',
|
'type' => ['string', 'integer'],
|
||||||
'description' => __( 'Filter order. This metadata is used if filters were manually ordered.', 'tainacan' ),
|
'description' => __( 'Filter order. This metadata is used if filters were manually ordered.', 'tainacan' ),
|
||||||
'validation' => ''
|
'validation' => ''
|
||||||
],
|
],
|
||||||
|
@ -75,6 +76,7 @@ class Filters extends Repository {
|
||||||
'description' => __( 'With this option enabled, the filter will appear as a button with an add icon, that should be pressed prior to loading any facet information.', 'tainacan' ),
|
'description' => __( 'With this option enabled, the filter will appear as a button with an add icon, that should be pressed prior to loading any facet information.', 'tainacan' ),
|
||||||
'on_error' => __( 'Please set the "Begin with filter collapsed" value as "yes" or "no"', 'tainacan' ),
|
'on_error' => __( 'Please set the "Begin with filter collapsed" value as "yes" or "no"', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'collection_id' => [
|
'collection_id' => [
|
||||||
|
@ -84,13 +86,6 @@ class Filters extends Repository {
|
||||||
'description' => __( 'The collection ID', 'tainacan' ),
|
'description' => __( 'The collection ID', 'tainacan' ),
|
||||||
'validation' => ''
|
'validation' => ''
|
||||||
],
|
],
|
||||||
'color' => [
|
|
||||||
'map' => 'meta',
|
|
||||||
'title' => __( 'Color', 'tainacan' ),
|
|
||||||
'type' => ['integer', 'string'],
|
|
||||||
'description' => __( 'Filter color', 'tainacan' ),
|
|
||||||
'validation' => ''
|
|
||||||
],
|
|
||||||
'metadatum_id' => [
|
'metadatum_id' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Metadata', 'tainacan' ),
|
'title' => __( 'Metadata', 'tainacan' ),
|
||||||
|
|
|
@ -32,7 +32,8 @@ class Items extends Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
'title' => [
|
'title' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Title', 'tainacan' ),
|
'title' => __( 'Title', 'tainacan' ),
|
||||||
|
@ -86,6 +87,7 @@ class Items extends Repository {
|
||||||
'title' => __( 'Term IDs', 'tainacan' ),
|
'title' => __( 'Term IDs', 'tainacan' ),
|
||||||
'type' => 'array',
|
'type' => 'array',
|
||||||
'description' => __( 'The item term IDs', 'tainacan' ),
|
'description' => __( 'The item term IDs', 'tainacan' ),
|
||||||
|
'items' => [ 'type' => ['string', 'integer'] ],
|
||||||
],
|
],
|
||||||
'document_type' => [
|
'document_type' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
|
@ -93,6 +95,7 @@ class Items extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The document type, can be a local attachment, an external URL or a text', 'tainacan' ),
|
'description' => __( 'The document type, can be a local attachment, an external URL or a text', 'tainacan' ),
|
||||||
'on_error' => __( 'Invalid document type', 'tainacan' ),
|
'on_error' => __( 'Invalid document type', 'tainacan' ),
|
||||||
|
'enum' => [ 'attachment', 'url', 'text', 'empty' ],
|
||||||
'validation' => v::stringType()->in( [ 'attachment', 'url', 'text', 'empty' ] ),
|
'validation' => v::stringType()->in( [ 'attachment', 'url', 'text', 'empty' ] ),
|
||||||
'default' => 'empty'
|
'default' => 'empty'
|
||||||
],
|
],
|
||||||
|
@ -141,7 +144,8 @@ class Items extends Repository {
|
||||||
'_thumbnail_id' => [
|
'_thumbnail_id' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Thumbnail', 'tainacan' ),
|
'title' => __( 'Thumbnail', 'tainacan' ),
|
||||||
'description' => __( 'Squared reduced-size version of a picture that helps recognizing and organizing files', 'tainacan' )
|
'description' => __( 'Squared reduced-size version of a picture that helps recognizing and organizing files', 'tainacan' ),
|
||||||
|
'type' => ['integer', 'string'],
|
||||||
],
|
],
|
||||||
'comment_status' => [
|
'comment_status' => [
|
||||||
'map' => 'comment_status',
|
'map' => 'comment_status',
|
||||||
|
@ -149,6 +153,7 @@ class Items extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Item comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
'description' => __( 'Item comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
|
||||||
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
|
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
|
||||||
|
'enum' => [ 'open', 'closed' ],
|
||||||
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
|
||||||
],
|
],
|
||||||
] );
|
] );
|
||||||
|
|
|
@ -46,7 +46,8 @@ class Logs extends Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
'title' => [
|
'title' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Title', 'tainacan' ),
|
'title' => __( 'Title', 'tainacan' ),
|
||||||
|
@ -59,7 +60,7 @@ class Logs extends Repository {
|
||||||
'map' => 'post_date',
|
'map' => 'post_date',
|
||||||
'title' => __( 'Log date', 'tainacan' ),
|
'title' => __( 'Log date', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The log date', 'tainacan' ),
|
'description' => __( 'The moment when the log was registered', 'tainacan' ),
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
'map' => 'post_content',
|
'map' => 'post_content',
|
||||||
|
@ -86,6 +87,7 @@ class Logs extends Repository {
|
||||||
'item_id' => [
|
'item_id' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Item ID', 'tainacan' ),
|
'title' => __( 'Item ID', 'tainacan' ),
|
||||||
|
'description' => __( 'Item ID', 'tainacan' ),
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
],
|
],
|
||||||
// 'value' => [
|
// 'value' => [
|
||||||
|
@ -98,34 +100,44 @@ class Logs extends Repository {
|
||||||
'log_diffs' => [ // deprecated
|
'log_diffs' => [ // deprecated
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Log differences', 'tainacan' ),
|
'title' => __( 'Log differences', 'tainacan' ),
|
||||||
'description' => __( 'Differences between old and new versions of object', 'tainacan' )
|
'description' => __( 'Differences between old and new versions of object', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
],
|
],
|
||||||
'collection_id' => [
|
'collection_id' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Log collection relationship', 'tainacan' ),
|
'title' => __( 'Log collection relationship', 'tainacan' ),
|
||||||
'description' => __( 'The ID of the collection that this log is related to', 'tainacan' )
|
'description' => __( 'The ID of the collection that this log is related to', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
],
|
],
|
||||||
'object_id' => [
|
'object_id' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Log item relationship', 'tainacan' ),
|
'title' => __( 'Log item relationship', 'tainacan' ),
|
||||||
'description' => __( 'The ID of the object that this log is related to', 'tainacan' ),
|
'description' => __( 'The ID of the object that this log is related to', 'tainacan' ),
|
||||||
|
'type' => ['string', 'integer'],
|
||||||
],
|
],
|
||||||
'object_type' => [
|
'object_type' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Log item relationship', 'tainacan' ),
|
'title' => __( 'Log item relationship', 'tainacan' ),
|
||||||
'description' => __( 'The type of the object that this log is related to', 'tainacan' ),
|
'description' => __( 'The type of the object that this log is related to', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
],
|
],
|
||||||
'old_value' => [
|
'old_value' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Old value', 'tainacan' ),
|
'title' => __( 'Old value', 'tainacan' ),
|
||||||
|
'description' => __( 'Value of the field previous to the edition registered by the log.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
],
|
],
|
||||||
'new_value' => [
|
'new_value' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'New value', 'tainacan' ),
|
'title' => __( 'New value', 'tainacan' ),
|
||||||
|
'description' => __( 'Value of the field after the edition registered by the log.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
],
|
],
|
||||||
'action' => [
|
'action' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Action', 'tainacan' ),
|
'title' => __( 'Action', 'tainacan' ),
|
||||||
|
'description' => __( 'Type of action registered by the log.', 'tainacan' ),
|
||||||
|
'type' => 'string',
|
||||||
]
|
]
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@ class Metadata_Sections extends Repository {
|
||||||
* @see \Tainacan\Repositories\Repository::get_map()
|
* @see \Tainacan\Repositories\Repository::get_map()
|
||||||
*/
|
*/
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
'name' => [
|
'name' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Name', 'tainacan' ),
|
'title' => __( 'Name', 'tainacan' ),
|
||||||
|
@ -68,6 +69,7 @@ class Metadata_Sections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Whether the section metadata description should be displayed below the name instead of inside a tooltip.', 'tainacan' ),
|
'description' => __( 'Whether the section metadata description should be displayed below the name instead of inside a tooltip.', 'tainacan' ),
|
||||||
'on_error' => __( 'Please set the "Description below name" value as "yes" or "no"', 'tainacan' ),
|
'on_error' => __( 'Please set the "Description below name" value as "yes" or "no"', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
|
@ -83,6 +85,7 @@ class Metadata_Sections extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Binds this section visibility to a set of rules related to some metadata values.', 'tainacan' ),
|
'description' => __( 'Binds this section visibility to a set of rules related to some metadata values.', 'tainacan' ),
|
||||||
'on_error' => __( 'Value should be "yes" or "no"', 'tainacan' ),
|
'on_error' => __( 'Value should be "yes" or "no"', 'tainacan' ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
|
|
|
@ -51,7 +51,8 @@ class Metadata extends Repository {
|
||||||
* @see \Tainacan\Repositories\Repository::get_map()
|
* @see \Tainacan\Repositories\Repository::get_map()
|
||||||
*/
|
*/
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
'name' => [
|
'name' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Name', 'tainacan' ),
|
'title' => __( 'Name', 'tainacan' ),
|
||||||
|
@ -70,7 +71,7 @@ class Metadata extends Repository {
|
||||||
'order' => [
|
'order' => [
|
||||||
'map' => 'menu_order',
|
'map' => 'menu_order',
|
||||||
'title' => __( 'Order', 'tainacan' ),
|
'title' => __( 'Order', 'tainacan' ),
|
||||||
'type' => 'string/integer',
|
'type' => ['string', 'integer'],
|
||||||
'description' => __( 'Metadata order. This metadata will be used if collections were manually ordered.', 'tainacan' ),
|
'description' => __( 'Metadata order. This metadata will be used if collections were manually ordered.', 'tainacan' ),
|
||||||
'on_error' => __( 'The menu order should be a numeric value', 'tainacan' ),
|
'on_error' => __( 'The menu order should be a numeric value', 'tainacan' ),
|
||||||
//'validation' => v::numeric(),
|
//'validation' => v::numeric(),
|
||||||
|
@ -100,6 +101,7 @@ class Metadata extends Repository {
|
||||||
'description' => __( 'Whether the metadatum description should be displayed below the input label instead of inside a tooltip.', 'tainacan' ),
|
'description' => __( 'Whether the metadatum description should be displayed below the input label instead of inside a tooltip.', 'tainacan' ),
|
||||||
'on_error' => __( 'Please set the "Description below name" value as "yes" or "no"', 'tainacan' ),
|
'on_error' => __( 'Please set the "Description below name" value as "yes" or "no"', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'placeholder' => [
|
'placeholder' => [
|
||||||
|
@ -124,6 +126,7 @@ class Metadata extends Repository {
|
||||||
'description' => __( 'The metadata is required. All items in this collection must fill this field', 'tainacan' ),
|
'description' => __( 'The metadata is required. All items in this collection must fill this field', 'tainacan' ),
|
||||||
'on_error' => __( 'The metadata content is invalid', 'tainacan' ),
|
'on_error' => __( 'The metadata content is invalid', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'collection_key' => [
|
'collection_key' => [
|
||||||
|
@ -133,6 +136,7 @@ class Metadata extends Repository {
|
||||||
'description' => __( 'Metadata value should be unique accross all items in this collection', 'tainacan' ),
|
'description' => __( 'Metadata value should be unique accross all items in this collection', 'tainacan' ),
|
||||||
'on_error' => __( 'You cannot have two items with the same value for this metadatum', 'tainacan' ),
|
'on_error' => __( 'You cannot have two items with the same value for this metadatum', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'multiple' => [
|
'multiple' => [
|
||||||
|
@ -143,6 +147,7 @@ class Metadata extends Repository {
|
||||||
'on_error' => __( 'Invalid multiple metadata', 'tainacan' ),
|
'on_error' => __( 'Invalid multiple metadata', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
|
||||||
// yes or no. It cant be multiple if its collection_key
|
// yes or no. It cant be multiple if its collection_key
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
'cardinality' => [
|
'cardinality' => [
|
||||||
|
@ -153,14 +158,6 @@ class Metadata extends Repository {
|
||||||
'on_error' => __( 'This number of multiple metadata is not allowed', 'tainacan' ),
|
'on_error' => __( 'This number of multiple metadata is not allowed', 'tainacan' ),
|
||||||
//'validation' => v::numeric()->positive(),
|
//'validation' => v::numeric()->positive(),
|
||||||
],
|
],
|
||||||
'mask' => [
|
|
||||||
'map' => 'meta',
|
|
||||||
'title' => __( 'Mask', 'tainacan' ),
|
|
||||||
'type' => 'string',
|
|
||||||
'description' => __( 'The mask to be used in the metadata', 'tainacan' ),
|
|
||||||
//'on_error' => __('Mask is invalid', 'tainacan'),
|
|
||||||
//'validation' => ''
|
|
||||||
],
|
|
||||||
'default_value' => [
|
'default_value' => [
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Default value', 'tainacan' ),
|
'title' => __( 'Default value', 'tainacan' ),
|
||||||
|
@ -170,7 +167,7 @@ class Metadata extends Repository {
|
||||||
'metadata_type_options' => [ // not showed in form
|
'metadata_type_options' => [ // not showed in form
|
||||||
'map' => 'meta',
|
'map' => 'meta',
|
||||||
'title' => __( 'Metadata type options', 'tainacan' ),
|
'title' => __( 'Metadata type options', 'tainacan' ),
|
||||||
'type' => ['array', 'object', 'string'],
|
'type' => ['array', 'object'],
|
||||||
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
|
||||||
'description' => __( 'Specific options for metadata type', 'tainacan' ),
|
'description' => __( 'Specific options for metadata type', 'tainacan' ),
|
||||||
// 'validation' => ''
|
// 'validation' => ''
|
||||||
|
@ -205,6 +202,7 @@ class Metadata extends Repository {
|
||||||
'title' => __( 'Display', 'tainacan' ),
|
'title' => __( 'Display', 'tainacan' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no', 'never' ] ),
|
'validation' => v::stringType()->in( [ 'yes', 'no', 'never' ] ),
|
||||||
|
'enum' => [ 'yes', 'no', 'never' ],
|
||||||
'description' => __( 'Display by default on listing or do not display or never display.', 'tainacan' ),
|
'description' => __( 'Display by default on listing or do not display or never display.', 'tainacan' ),
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
|
@ -223,6 +221,7 @@ class Metadata extends Repository {
|
||||||
'description' => __( 'Makes this metadatum a repository level metadatum instead of collection metadatum', 'tainacan' ),
|
'description' => __( 'Makes this metadatum a repository level metadatum instead of collection metadatum', 'tainacan' ),
|
||||||
'on_error' => __( 'Invalid value for repository metadata', 'tainacan' ),
|
'on_error' => __( 'Invalid value for repository metadata', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
// yes or no. It cant be multiple if its collection_key
|
// yes or no. It cant be multiple if its collection_key
|
||||||
'default' => 'no'
|
'default' => 'no'
|
||||||
],
|
],
|
||||||
|
|
|
@ -56,10 +56,11 @@ abstract class Repository {
|
||||||
* Register hooks
|
* Register hooks
|
||||||
*/
|
*/
|
||||||
protected function __construct() {
|
protected function __construct() {
|
||||||
|
$name = $this->get_name();
|
||||||
add_action( 'init', array( &$this, 'register_post_type' ) );
|
add_action( 'init', array( &$this, 'register_post_type' ) );
|
||||||
add_action( 'init', array( &$this, 'init_objects' ) );
|
add_action( 'init', array( &$this, 'init_objects' ) );
|
||||||
|
|
||||||
add_filter( 'tainacan-get-map-' . $this->get_name(), array( $this, 'get_default_properties' ) );
|
add_filter( "tainacan-get-map-$name", array( $this, 'get_default_properties' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init_objects() {
|
public function init_objects() {
|
||||||
|
@ -630,8 +631,9 @@ abstract class Repository {
|
||||||
*/
|
*/
|
||||||
public function delete( Entities\Entity $entity, $permanent = true ) {
|
public function delete( Entities\Entity $entity, $permanent = true ) {
|
||||||
|
|
||||||
|
$post_type = $entity->get_post_type();
|
||||||
do_action( 'tainacan-pre-delete', $entity, $permanent );
|
do_action( 'tainacan-pre-delete', $entity, $permanent );
|
||||||
do_action( 'tainacan-pre-delete-' . $entity->get_post_type(), $entity, $permanent );
|
do_action( "tainacan-pre-delete-$post_type", $entity, $permanent );
|
||||||
|
|
||||||
if ($permanent === true) {
|
if ($permanent === true) {
|
||||||
$return = wp_delete_post( $entity->get_id(), $permanent );
|
$return = wp_delete_post( $entity->get_id(), $permanent );
|
||||||
|
@ -642,8 +644,9 @@ abstract class Repository {
|
||||||
|
|
||||||
if ( $return instanceof \WP_Post && $this->use_logs ) {
|
if ( $return instanceof \WP_Post && $this->use_logs ) {
|
||||||
|
|
||||||
|
$post_type = $entity->get_post_type();
|
||||||
do_action( 'tainacan-deleted', $entity, $permanent );
|
do_action( 'tainacan-deleted', $entity, $permanent );
|
||||||
do_action( 'tainacan-deleted-' . $entity->get_post_type(), $entity, $permanent );
|
do_action( "tainacan-deleted-$post_type", $entity, $permanent );
|
||||||
|
|
||||||
$return = $this->get_entity_by_post($return);
|
$return = $this->get_entity_by_post($return);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ class Taxonomies extends Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity", [
|
||||||
'name' => [
|
'name' => [
|
||||||
'map' => 'post_title',
|
'map' => 'post_title',
|
||||||
'title' => __( 'Name', 'tainacan' ),
|
'title' => __( 'Name', 'tainacan' ),
|
||||||
|
@ -63,6 +64,7 @@ class Taxonomies extends Repository {
|
||||||
'description' => __( 'Allow/Deny the creation of new terms in the taxonomy', 'tainacan' ),
|
'description' => __( 'Allow/Deny the creation of new terms in the taxonomy', 'tainacan' ),
|
||||||
'on_error' => __( 'Invalid insertion, allowed values are ( yes/no )', 'tainacan' ),
|
'on_error' => __( 'Invalid insertion, allowed values are ( yes/no )', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'yes'
|
'default' => 'yes'
|
||||||
],
|
],
|
||||||
'hierarchical' => [
|
'hierarchical' => [
|
||||||
|
@ -72,6 +74,7 @@ class Taxonomies extends Repository {
|
||||||
'description' => __( 'Allow/Deny the existence of terms children to build a hierarchy', 'tainacan' ),
|
'description' => __( 'Allow/Deny the existence of terms children to build a hierarchy', 'tainacan' ),
|
||||||
'on_error' => __( 'Invalid insertion, allowed values are ( yes/no )', 'tainacan' ),
|
'on_error' => __( 'Invalid insertion, allowed values are ( yes/no )', 'tainacan' ),
|
||||||
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
|
||||||
|
'enum' => [ 'yes', 'no' ],
|
||||||
'default' => 'yes'
|
'default' => 'yes'
|
||||||
],
|
],
|
||||||
'enabled_post_types' => [
|
'enabled_post_types' => [
|
||||||
|
|
|
@ -30,7 +30,8 @@ class Terms extends Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _get_map() {
|
protected function _get_map() {
|
||||||
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
|
$entity = $this->get_name();
|
||||||
|
return apply_filters( "tainacan-get-map-$entity" , [
|
||||||
'term_id' => [
|
'term_id' => [
|
||||||
'map' => 'term_id',
|
'map' => 'term_id',
|
||||||
'title' => __( 'ID', 'tainacan' ),
|
'title' => __( 'ID', 'tainacan' ),
|
||||||
|
|
|
@ -1742,9 +1742,11 @@ class Theme_Helper {
|
||||||
$before = str_replace('$id', ' id="metadata-id-' . $metadatum->get_id() . '"', $before);
|
$before = str_replace('$id', ' id="metadata-id-' . $metadatum->get_id() . '"', $before);
|
||||||
|
|
||||||
// Let theme authors tweak the wrapper opener
|
// Let theme authors tweak the wrapper opener
|
||||||
|
$metadata_type = $metadatum->get_metadata_type();
|
||||||
|
$metadatum_id = $metadatum->get_id();
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before', $before, $item_metadatum );
|
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before', $before, $item_metadatum );
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before--type-' . $metadatum->get_metadata_type(), $before, $item_metadatum );
|
$before = apply_filters( "tainacan-get-item-metadatum-as-html-before--type-$metadata_type", $before, $item_metadatum );
|
||||||
$before = apply_filters( 'tainacan-get-item-metadatum-as-html-before--id-' . $metadatum->get_id(), $before, $item_metadatum );
|
$before = apply_filters( "tainacan-get-item-metadatum-as-html-before--id-$metadatum_id", $before, $item_metadatum );
|
||||||
|
|
||||||
// Renders the metadatum opener
|
// Renders the metadatum opener
|
||||||
$return .= $before;
|
$return .= $before;
|
||||||
|
@ -1766,8 +1768,10 @@ class Theme_Helper {
|
||||||
$after = $args['after'];
|
$after = $args['after'];
|
||||||
|
|
||||||
// Let theme authors tweak the wrapper closer
|
// Let theme authors tweak the wrapper closer
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--id-' . $metadatum->get_id(), $after, $item_metadatum );
|
$metadatum_id = $metadatum->get_id();
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--type-' . $metadatum->get_metadata_type(), $after, $item_metadatum );
|
$metadata_type = $metadatum->get_metadata_type();
|
||||||
|
$after = apply_filters( "tainacan-get-item-metadatum-as-html-after--id-$metadatum_id", $after, $item_metadatum );
|
||||||
|
$after = apply_filters( "tainacan-get-item-metadatum-as-html-after--type-$metadata_type", $after, $item_metadatum );
|
||||||
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after', $after, $item_metadatum );
|
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after', $after, $item_metadatum );
|
||||||
|
|
||||||
// Closes the wrapper
|
// Closes the wrapper
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
=== Tainacan ===
|
=== Tainacan ===
|
||||||
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi
|
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi
|
||||||
Tags: museums, libraries, archives, GLAM, collections, repository
|
Tags: museums, libraries, archives, GLAM, collections, repository
|
||||||
Requires at least: 5.0
|
Requires at least: 5.9
|
||||||
Tested up to: 6.2.2
|
Tested up to: 6.3
|
||||||
Requires PHP: 5.6
|
Requires PHP: 7.0
|
||||||
Stable tag: 0.20.3
|
Stable tag: 0.20.4
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,18 @@ Plugin Name: Tainacan
|
||||||
Plugin URI: https://tainacan.org/
|
Plugin URI: https://tainacan.org/
|
||||||
Description: Open source, powerful 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 repository platform.
|
Description: Open source, powerful 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 repository platform.
|
||||||
Author: Tainacan.org
|
Author: Tainacan.org
|
||||||
Version: 0.20.3
|
Author URI: https://tainacan.org/
|
||||||
Requires at least: 5.0
|
Version: 0.20.4
|
||||||
Tested up to: 6.2.2
|
Requires at least: 5.9
|
||||||
Requires PHP: 5.6
|
Tested up to: 6.3
|
||||||
Stable tag: 0.20.3
|
Requires PHP: 7.0
|
||||||
|
Stable tag: 0.20.4
|
||||||
Text Domain: tainacan
|
Text Domain: tainacan
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TAINACAN_VERSION = '0.20.3';
|
const TAINACAN_VERSION = '0.20.4';
|
||||||
|
|
||||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
||||||
|
|
|
@ -296,7 +296,7 @@ abstract class Metadata_Type {
|
||||||
|
|
||||||
$attributes['name'] = $this->get_name();
|
$attributes['name'] = $this->get_name();
|
||||||
$attributes['description'] = $this->get_description();
|
$attributes['description'] = $this->get_description();
|
||||||
$attributes['errors'] = $this->get_errors();
|
// $attributes['errors'] = $this->get_errors(); // Does it make sense to show errors in the API?
|
||||||
$attributes['related_mapped_prop'] = $this->get_related_mapped_prop();
|
$attributes['related_mapped_prop'] = $this->get_related_mapped_prop();
|
||||||
$attributes['options'] = $this->get_options();
|
$attributes['options'] = $this->get_options();
|
||||||
$attributes['className'] = get_class($this);
|
$attributes['className'] = get_class($this);
|
||||||
|
|
|
@ -214,9 +214,23 @@
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field.is-horizontal :deep(.label) {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field.is-horizontal :deep(.has-numberinput) {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-card-foot {
|
.modal-card-foot {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 769px) {
|
||||||
|
.modal-card {
|
||||||
|
max-width: 640px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
.modal-card {
|
.modal-card {
|
||||||
background-color: var(--tainacan-background-color);
|
background-color: var(--tainacan-background-color);
|
||||||
color: var(--tainacan-secondary);
|
color: var(--tainacan-secondary);
|
||||||
border-radius: 10px;
|
border-radius: 6px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding: 35px;
|
padding: 35px;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"name": "tainacan/carousel-collections-list",
|
"name": "tainacan/carousel-collections-list",
|
||||||
"title": "Tainacan Collections Carousel",
|
"title": "Tainacan Collections Carousel",
|
||||||
"apiVersion": 2,
|
"apiVersion": 3,
|
||||||
"category": "tainacan-blocks",
|
"category": "tainacan-blocks",
|
||||||
"keywords": [ "collections", "carousel", "slider" ],
|
"keywords": [ "collections", "carousel", "slider" ],
|
||||||
"description": "List collections on a Carousel, displaying either its thumbnail or a preview of its items.",
|
"description": "List collections on a Carousel, displaying either its thumbnail or a preview of its items.",
|
||||||
|
@ -122,5 +122,5 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"editorScript": "carousel-collections-list",
|
"editorScript": "carousel-collections-list",
|
||||||
"editorStyle": "carousel-collections-list"
|
"editorStyle": ["carousel-collections-list", "tainacan-blocks-common-editor-styles" ]
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const { RangeControl, Spinner, Button, BaseControl, ToggleControl, SelectControl, Placeholder, IconButton, PanelBody } = wp.components;
|
const { RangeControl, Spinner, Button, BaseControl, ToggleControl, SelectControl, Placeholder, PanelBody } = wp.components;
|
||||||
|
|
||||||
const { InspectorControls, BlockControls, useBlockProps, store } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
const { InspectorControls, BlockControls, useBlockProps, store } = wp.blockEditor;
|
||||||
|
|
||||||
const { __ } = wp.i18n;
|
const { __ } = wp.i18n;
|
||||||
|
|
||||||
|
@ -14,12 +14,8 @@ import axios from 'axios';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
import { ThumbnailHelperFunctions } from '../../../admin/js/utilities.js';
|
import { ThumbnailHelperFunctions } from '../../../admin/js/utilities.js';
|
||||||
import TainacanBlocksCompatToolbar from '../../js/compatibility/tainacan-blocks-compat-toolbar.js';
|
import TainacanBlocksCompatToolbar from '../../js/compatibility/tainacan-blocks-compat-toolbar.js';
|
||||||
import 'swiper/css';
|
|
||||||
import 'swiper/css/a11y';
|
|
||||||
import 'swiper/css/autoplay';
|
|
||||||
import 'swiper/css/navigation';
|
|
||||||
|
|
||||||
export default function ({ attributes, setAttributes, className, isSelected, clientId }) {
|
export default function ({ attributes, setAttributes, isSelected, clientId }) {
|
||||||
let {
|
let {
|
||||||
collections,
|
collections,
|
||||||
content,
|
content,
|
||||||
|
@ -42,7 +38,8 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
|
||||||
} = attributes;
|
} = attributes;
|
||||||
|
|
||||||
// Gets blocks props from hook
|
// Gets blocks props from hook
|
||||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps();
|
const blockProps = useBlockProps();
|
||||||
|
const className = blockProps.className;
|
||||||
|
|
||||||
// Obtains block's client id to render it on save function
|
// Obtains block's client id to render it on save function
|
||||||
setAttributes({ blockId: clientId });
|
setAttributes({ blockId: clientId });
|
||||||
|
@ -81,17 +78,12 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
|
||||||
<li
|
<li
|
||||||
key={ collection.id }
|
key={ collection.id }
|
||||||
className={ 'swiper-slide collection-list-item ' + (!showCollectionThumbnail ? 'collection-list-item-grid ' : '') + (maxCollectionsPerScreen ? ' max-collections-per-screen-' + maxCollectionsPerScreen : '') }>
|
className={ 'swiper-slide collection-list-item ' + (!showCollectionThumbnail ? 'collection-list-item-grid ' : '') + (maxCollectionsPerScreen ? ' max-collections-per-screen-' + maxCollectionsPerScreen : '') }>
|
||||||
{ tainacan_blocks.wp_version < '5.4' ?
|
<Button
|
||||||
<IconButton
|
onClick={ () => removeItemOfId(collection.id) }
|
||||||
onClick={ () => removeItemOfId(collection.id) }
|
icon={ () => (
|
||||||
icon="no-alt"
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg>
|
||||||
label={__('Remove', 'tainacan')}/>
|
) }
|
||||||
:
|
label={__('Remove', 'tainacan')}/>
|
||||||
<Button
|
|
||||||
onClick={ () => removeItemOfId(collection.id) }
|
|
||||||
icon="no-alt"
|
|
||||||
label={__('Remove', 'tainacan')}/>
|
|
||||||
}
|
|
||||||
<a
|
<a
|
||||||
id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id }
|
id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id }
|
||||||
href={ collection.url }>
|
href={ collection.url }>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const { useBlockProps } = (tainacan_blocks.wp_version < '5.2' ? wp.editor : wp.blockEditor );
|
const { useBlockProps } = wp.blockEditor;
|
||||||
|
|
||||||
export default function ({ attributes, className }) {
|
export default function ({ attributes }) {
|
||||||
const {
|
const {
|
||||||
content,
|
content,
|
||||||
blockId,
|
blockId,
|
||||||
|
@ -21,7 +21,7 @@ export default function ({ attributes, className }) {
|
||||||
} = attributes;
|
} = attributes;
|
||||||
|
|
||||||
// Gets attributes such as style, that are automatically added by the editor hook
|
// Gets attributes such as style, that are automatically added by the editor hook
|
||||||
const blockProps = tainacan_blocks.wp_version < '5.6' ? { className: className } : useBlockProps.save();
|
const blockProps = useBlockProps.save();
|
||||||
return <div
|
return <div
|
||||||
{ ...blockProps }
|
{ ...blockProps }
|
||||||
data-module="carousel-collections-list"
|
data-module="carousel-collections-list"
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
@import '../../scss/gutenberg-blocks-variables.scss';
|
@import '../../scss/gutenberg-blocks-variables.scss';
|
||||||
|
@import '../../../../../node_modules/swiper/swiper.scss';
|
||||||
|
@import '../../../../../node_modules/swiper/modules/navigation/navigation.scss';
|
||||||
|
@import '../../../../../node_modules/swiper/modules/a11y/a11y.scss';
|
||||||
|
@import '../../../../../node_modules/swiper/modules/autoplay/autoplay.scss';
|
||||||
|
|
||||||
.components-panel__body .collection-carousel-view-modes {
|
.components-panel__body .collection-carousel-view-modes {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -138,7 +142,7 @@
|
||||||
margin: 0 var(--spaceAroundCarousel, 50px);
|
margin: 0 var(--spaceAroundCarousel, 50px);
|
||||||
|
|
||||||
ul.swiper-wrapper {
|
ul.swiper-wrapper {
|
||||||
list-style: none;
|
list-style: none !important;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
@ -378,7 +382,7 @@
|
||||||
right: -8px;
|
right: -8px;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
border: 1px solid var(--tainacan-block-gray3, $gray3);
|
border: 1px solid var(--tainacan-block-gray3, $gray3);
|
||||||
border-radius: 12px;
|
border-radius: 100em;
|
||||||
transition: opacity linear 0.15s, right linear 0.15s;
|
transition: opacity linear 0.15s, right linear 0.15s;
|
||||||
}
|
}
|
||||||
&:hover button:hover {
|
&:hover button:hover {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"name": "tainacan/carousel-items-list",
|
"name": "tainacan/carousel-items-list",
|
||||||
"title": "Tainacan Collection's Items Carousel",
|
"title": "Tainacan Collection's Items Carousel",
|
||||||
"apiVersion": 2,
|
"apiVersion": 3,
|
||||||
"category": "tainacan-blocks",
|
"category": "tainacan-blocks",
|
||||||
"keywords": [ "items", "carousel", "slider" ],
|
"keywords": [ "items", "carousel", "slider" ],
|
||||||
"description": "List items on a Carousel, using search or item selection.",
|
"description": "List items on a Carousel, using search or item selection.",
|
||||||
|
@ -142,5 +142,5 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"editorScript": "carousel-items-list",
|
"editorScript": "carousel-items-list",
|
||||||
"editorStyle": "carousel-items-list"
|
"editorStyle": [ "carousel-items-list", "tainacan-blocks-common-editor-styles" ]
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue