Merge branch 'develop' into feature/794.

This commit is contained in:
mateuswetah 2023-08-14 18:32:16 -03:00
commit b5bc411dee
169 changed files with 3845 additions and 1666 deletions

View File

@ -23,8 +23,8 @@ jobs:
matrix:
# Notes regarding supported versions in WP:
# 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']
wp: ['latest', '5.4']
php: ['7.0', '7.3', '7.4']
wp: ['latest', '5.9']
experimental: [false]
# include:
@ -50,7 +50,7 @@ jobs:
# in combination with PHP < 7.4 is not properly/sufficiently supported
# within WP Core.
# 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:
MYSQL_ALLOW_EMPTY_PASSWORD: false
ports:

View File

@ -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.

View File

@ -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

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -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());
}

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -1 +0,0 @@
This page was moved to https://tainacan.github.io/tainacan-wiki/

View File

@ -32,7 +32,7 @@
"react-dom": "^17.0.2",
"sortablejs": "^1.15.0",
"sortablejs-vue3": "^1.2.9",
"swiper": "^8.4.5",
"swiper": "^8.4.7",
"vue": "^3.3.4",
"vue-countup-v3": "^1.3.0",
"vue-router": "^4.2.4",

View File

@ -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, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgE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AJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA") 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 {
display: flex;
margin: 12px 0 24px 0; }
@ -118,7 +326,7 @@
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper {
margin: 0 var(--spaceAroundCarousel, 50px); }
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper ul.swiper-wrapper {
list-style: none;
list-style: none !important;
padding: 0;
margin: 0;
height: auto; }
@ -313,7 +521,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

File diff suppressed because one or more lines are too long

View File

@ -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, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJK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/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA") 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 {
margin: 2em auto;
--swiper-navigation-color: var(--tainacan-block-primary, $primary);
@ -125,7 +333,7 @@
.wp-block-tainacan-carousel-items-list .tainacan-carousel .swiper {
margin: 0 var(--spaceAroundCarousel, 50px); }
.wp-block-tainacan-carousel-items-list .tainacan-carousel .swiper ul.swiper-wrapper {
list-style: none;
list-style: none !important;
padding: 0;
margin: 0;
height: auto; }
@ -305,7 +513,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

File diff suppressed because one or more lines are too long

View File

@ -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, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGM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O3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA") 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 {
display: flex;
margin: 12px 0 24px 0; }
@ -118,7 +326,7 @@
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper {
margin: 0 var(--spaceAroundCarousel, 50px); }
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper ul.swiper-wrapper {
list-style: none;
list-style: none !important;
padding: 0;
margin: 0;
height: auto; }
@ -313,7 +521,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

File diff suppressed because one or more lines are too long

View File

@ -91,7 +91,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,mCAAoC;EAChC,MAAM,EAAE,QAAQ;EAGhB,uDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;gGAC2D;IACvD,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;8FACyD;IACrD,qBAAqB,EAAE,wBAAwB;IAC/C,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,eAAe;IAEnC;mGAAG;MACC,UAAU,EAAE,YAAY;MACxB,YAAY,EAAE,YAAY;MAC1B,WAAW,EAAE,YAAY;MACzB,MAAM,EAAE,gBAAgB;MAExB;yGAAI;QACA,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,cAAc;EAIzC;sFACiD;IAC7C,OAAO,EAAE,CAAC;ICtCd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IDqCT,gBAAgB,EAAE,6BAA6B;IAC/C,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IAErB;gHAAwB;MACpB,QAAQ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EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,UAAU;MAG1B;sHAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAItB;iJAA+B;QAC3B,OAAO,EAAE,IAAI;MAGjB;;0HACU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QApC/C;oHAAwB;UAqChB,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAzC/C;oHAAwB;UA0ChB,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA9C9C;oHAAwB;UA+ChB,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAnD9C;oHAAwB;UAoDhB,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB;;AAOhC;iIACa;EACT,KAAK,EAAE,OAAO",
"sources": ["../../views/gutenberg-blocks/blocks/collections-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-collections-list.css"

View File

@ -216,7 +216,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

File diff suppressed because one or more lines are too long

View File

@ -207,7 +207,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

File diff suppressed because one or more lines are too long

View File

@ -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, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAx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GLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA") 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-button-prev,
.item-gallery-edit-container .tainacan-media-component .swiper-button-next {
@ -85,7 +293,7 @@
fill: currentColor; }
.tainacan-media-component__swiper-main ul.swiper-wrapper,
.tainacan-media-component__swiper-thumbs ul.swiper-wrapper {
list-style: none;
list-style: none !important;
padding: 0; }
.tainacan-media-component__swiper-main {

File diff suppressed because one or more lines are too long

View File

@ -95,7 +95,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;8EAC+C;IAC3C,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;4EAC6C;IACzC,qBAAqB,EAAE,wBAAwB;IAC/C,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,eAAe;IAEnC;iFAAG;MACC,UAAU,EAAE,YAAY;MACxB,YAAY,EAAE,YAAY;MAC1B,WAAW,EAAE,YAAY;MACzB,MAAM,EAAE,gBAAgB;MAExB;uFAAI;QACA,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,cAAc;EAIzC;oEACqC;IACjC,OAAO,EAAE,CAAC;ICtCd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IDqCT,gBAAgB,EAAE,6BAA6B;IAC/C,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,WAAW,EAAE,UAAU;IACvB,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,KAAK;MACd,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,KAAK,EAAE,KAAK;MAEZ;4FAAE;QACE,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,MAAM;QAE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ACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;;kGACU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAnC/C;4FAAkB;UAoCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAxC/C;4FAAkB;UAyCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA7C9C;4FAAkB;UA8CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAlD9C;4FAAkB;UAmDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB;;AAOhC;qHACa;EACT,KAAK,EAAE,OAAO",
"sources": ["../../views/gutenberg-blocks/blocks/items-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-items-list.css"

View File

@ -75,7 +75,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, #a5a5a5);
border-radius: 12px;
border-radius: 100em;
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 {
background-color: white !important;

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;8EAC+C;IAC3C,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,CAAC;EAId;oEACqC;IACjC,OAAO,EAAE,CAAC;ICpBd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;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,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;;kGACU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAnC/C;4FAAkB;UAoCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAxC/C;4FAAkB;UAyCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA7C9C;4FAAkB;UA8CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAlD9C;4FAAkB;UAmDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB;;AAOhC;qHACa;EACT,KAAK,EAAE,OAAO",
"sources": ["../../views/gutenberg-blocks/blocks/terms-list/style.scss","../../views/gutenberg-blocks/scss/gutenberg-blocks-variables.scss"],
"names": [],
"file": "tainacan-gutenberg-block-terms-list.css"

View File

@ -2,7 +2,7 @@
namespace Tainacan\API;
class REST_Controller extends \WP_REST_Controller {
abstract class REST_Controller extends \WP_REST_Controller {
/**
* REST_Controller constructor.
@ -627,6 +627,9 @@ class REST_Controller extends \WP_REST_Controller {
'description' => $value['description'],
'type' => $value['type']
];
if( isset($value['items'])) {
$schema[$mapped]['items'] = $value['items'];
}
}
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;
}
}

View File

@ -14,6 +14,10 @@ class REST_Background_Processes_Controller extends REST_Controller {
private $collections_repository;
private $collection;
protected function get_schema() {
return "TODO:get_schema";
}
/**
* REST_Background_Processes_Controller constructor.
* Define the namespace, rest base and instantiate your attributes.

View File

@ -8,6 +8,9 @@ use Tainacan\Repositories;
use Tainacan\Entities\Entity;
class REST_Bulkedit_Controller extends REST_Controller {
private $metadatum_repository;
private $collections_repository;
public function __construct() {
$this->rest_base = 'bulk-edit';
@ -34,6 +37,7 @@ class REST_Bulkedit_Controller extends REST_Controller {
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'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]+)',
@ -42,7 +46,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'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',
@ -51,17 +57,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'add_value'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'metadatum_id' => [
'type' => 'integer',
'description' => __( 'The metadatum ID', 'tainacan' ),
],
'value' => [
'type' => ['string', 'integer'],
'description' => __( 'The value to be added', 'tainacan' ),
],
],
'args' => $this->get_actions_params('add')
),
'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',
@ -70,7 +68,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'trash_items'),
'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',
@ -79,7 +79,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'untrash_items'),
'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',
@ -88,7 +90,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'delete_items'),
'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',
@ -97,13 +101,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'set_status'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'value' => [
'type' => 'string',
'description' => __( 'The new status value', 'tainacan' ),
],
],
'args' => $this->get_actions_params('set_status')
),
'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',
@ -112,17 +112,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'set_value'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'metadatum_id' => [
'type' => 'integer',
'description' => __( 'The metadatum ID', 'tainacan' ),
],
'value' => [
'type' => ['string', 'integer', 'array'],
'description' => __( 'The value to be set', 'tainacan' ),
],
],
'args' => $this->get_actions_params('set')
),
'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',
@ -131,17 +123,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'copy_value'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'metadatum_id_to' => [
'type' => 'integer',
'description' => __( 'The metadatum ID', 'tainacan' ),
],
'metadatum_id_from' => [
'type' => ['string', 'integer'],
'description' => __( 'The metadatum ID to be copied', 'tainacan' ),
],
],
'args' => $this->get_actions_params('copy_value')
),
'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',
@ -150,17 +134,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'remove_value'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'metadatum_id' => [
'type' => 'integer',
'description' => __( 'The metadatum ID', 'tainacan' ),
],
'value' => [
'type' => ['string', 'integer'],
'description' => __( 'The value to be added', 'tainacan' ),
],
],
'args' => $this->get_actions_params('remove')
),
'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',
@ -169,21 +145,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'replace_value'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'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' ),
],
],
'args' => $this->get_actions_params('replace')
),
'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',
@ -192,13 +156,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'clear_value'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'metadatum_id' => [
'type' => 'integer',
'description' => __( 'The metadatum ID', 'tainacan' ),
]
],
'args' => $this->get_actions_params('clear')
),
'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',
@ -207,13 +167,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'set_comment_status'),
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
'args' => [
'value' => [
'type' => 'string',
'description' => __( 'The new comments status (open or closed)', 'tainacan' ),
],
],
'args' => $this->get_actions_params('set_comment_status')
),
'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]+)',
@ -222,7 +178,9 @@ class REST_Bulkedit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item_in_sequence'),
'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' ),
];
$query_params['collection_id'] = [
'type' => 'string',
'description' => __( 'Collection ID', 'tainacan' ),
];
$query_params['use_query'] = [
'type' => ['boolean', 'object'],
'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;
}
}
/**
* @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;
}
}

View File

@ -15,6 +15,7 @@ use Tainacan\Entities\Collection;
class REST_Collections_Controller extends REST_Controller {
private $collections_repository;
private $collection;
private $items_repository;
/**
* REST_Collections_Controller constructor.
@ -52,15 +53,19 @@ class REST_Collections_Controller extends REST_Controller {
'permission_callback' => array($this, 'create_item_permissions_check'),
'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(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => $this->get_wp_query_params(),
'args' => [
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
]
],
),
array(
'methods' => \WP_REST_Server::EDITABLE,
@ -73,6 +78,10 @@ class REST_Collections_Controller extends REST_Controller {
'callback' => array($this, 'delete_item'),
'permission_callback' => array($this, 'delete_item_permissions_check'),
'args' => array(
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
],
'permanently' => array(
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
'default' => '0',
@ -87,11 +96,11 @@ class REST_Collections_Controller extends REST_Controller {
'callback' => array($this, 'update_metadata_section_order'),
'permission_callback' => array($this, 'update_metadata_section_order_permissions_check'),
'args' => [
'metadata_section_order' => [
'description' => __( 'The order of the metadata section in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'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'],
@ -102,11 +111,10 @@ class REST_Collections_Controller extends REST_Controller {
'callback' => array($this, 'update_metadata_order'),
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
'args' => [
'metadata_order' => [
'description' => __( 'The order of the metadata in the section, an array of objects with integer ID and bool enabled.', 'tainacan' ),
'metadata_order' => $this->get_endpoint_arg_for_schema('metadata_order', [
'required' => true,
'validate_callback' => [$this, 'validate_filters_metadata_order']
]
])
],
),
'schema' => [$this, 'get_schema'],
@ -117,11 +125,10 @@ class REST_Collections_Controller extends REST_Controller {
'callback' => array($this, 'update_metadata_order'),
'permission_callback' => array($this, 'update_metadata_order_permissions_check'),
'args' => [
'metadata_order' => [
'description' => __( 'The order of the metadata in the section, an array of objects with integer ID and bool enabled.', 'tainacan' ),
'metadata_order' => $this->get_endpoint_arg_for_schema('metadata_order', [
'required' => true,
'validate_callback' => [$this, 'validate_filters_metadata_order']
]
])
],
),
'schema' => [$this, 'get_schema'],
@ -132,11 +139,10 @@ class REST_Collections_Controller extends REST_Controller {
'callback' => array($this, 'update_filters_order'),
'permission_callback' => array($this, 'update_filters_order_permissions_check'),
'args' => [
'filters_order' => [
'description' => __( 'The order of the filters in the collection, an array of objects with integer ID and bool enabled.', 'tainacan' ),
'filters_order' => $this->get_endpoint_arg_for_schema('filters_order', [
'required' => true,
'validate_callback' => [$this, 'validate_filters_metadata_order']
]
])
],
),
'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 ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args['name'] = array(
'description' => __('Limits the result set to collections with a specific name'),
'type' => 'string',
);
switch ( $method ) {
case \WP_REST_Server::READABLE:
$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(
$endpoint_args,
parent::get_wp_query_params(),
parent::get_fetch_only_param(),
parent::get_meta_queries_params()
);
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->collections_repository->get_map();
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]);
// 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;
}
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() {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'collection',
'type' => 'object'
'type' => 'object',
'tags' => [ $this->rest_base ],
];
$main_schema = parent::get_repository_schema( $this->collections_repository );
@ -902,8 +929,8 @@ class REST_Collections_Controller extends REST_Controller {
);
return $schema;
}
}
?>

View File

@ -12,6 +12,7 @@ use \Tainacan\Exposers\Mappers\Value;
*
* */
class REST_Exporters_Controller extends REST_Controller {
private $collections_repository;
/**
* REST_Exporters_Controller constructor.
@ -40,6 +41,7 @@ class REST_Exporters_Controller extends REST_Controller {
'callback' => array($this, 'get_registered_exporters'),
'permission_callback' => array($this, 'export_permissions_check'),
),
'schema' => [$this, 'get_schema_exporters_available']
));
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'),
'permission_callback' => array($this, 'export_permissions_check'),
'args' => [
'importer_slug' => [
'exporter_slug' => [
'type' => 'string',
'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(
@ -62,6 +65,10 @@ class REST_Exporters_Controller extends REST_Controller {
'callback' => array($this, 'update_item'),
'permission_callback' => array($this, 'export_permissions_check'),
'args' => [
'session_id' => [
'type' => 'string',
'description' => __( 'The ID for this exporter session', 'tainacan' ),
],
'send_email' => [
'type' => 'string',
'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(
@ -83,7 +91,14 @@ class REST_Exporters_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'run'),
'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;
}
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;
}
}

View File

@ -7,9 +7,14 @@ use Tainacan\Mappers_Handler;
use \Tainacan\API\REST_Controller;
class REST_Exposers_Controller extends REST_Controller {
private $metadatum_repository;
private $exposers;
private $mappers;
protected function get_schema() {
return "TODO:get_schema";
}
/**
* REST_Facets_Controller constructor.

View File

@ -7,8 +7,6 @@ use Tainacan\Entities;
use \Tainacan\API\REST_Controller;
class REST_Facets_Controller extends REST_Controller {
private $metadatum_repository;
/**
@ -34,16 +32,34 @@ class REST_Facets_Controller extends REST_Controller {
array(
'methods' => \WP_REST_Server::READABLE,
'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(
array(
'methods' => \WP_REST_Server::READABLE,
'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;
}
}
?>

View File

@ -20,30 +20,9 @@ class REST_Filter_Types_Controller extends REST_Controller {
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'permission_callback' => array($this, 'get_items_permissions_check'),
'args' => [
'filter-type' => [
'description' => __('Returns the structure of the objects.'),
'items' => [
'className' => [
'type' => 'string'
],
'name' => [
'type' => 'string'
],
'component' => [
'type' => 'string'
],
'supported_types' => [
'type' => 'array',
'items' => [
'type' => 'string'
]
]
]
]
]
)
'permission_callback' => array($this, 'get_items_permissions_check')
),
'schema' => [$this, 'get_list_schema']
)
);
}
@ -88,6 +67,51 @@ class REST_Filter_Types_Controller extends REST_Controller {
public function get_items_permissions_check( $request ) {
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;
}
}
?>

View File

@ -10,7 +10,6 @@ class REST_Filters_Controller extends REST_Controller {
private $collection;
private $collection_repository;
private $metadatum;
private $metadatum_repository;
private $filter_repository;
@ -42,7 +41,7 @@ class REST_Filters_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'create_item'),
'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']
));
@ -57,9 +56,9 @@ class REST_Filters_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'create_item'),
'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(
array(
@ -74,19 +73,14 @@ class REST_Filters_Controller extends REST_Controller {
'permission_callback' => array($this, 'create_item_permissions_check'),
'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(
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'
),
)
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
),
array(
'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)
),
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
'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']
));
@ -228,7 +222,7 @@ class REST_Filters_Controller extends REST_Controller {
if (! $filter instanceof Entities\Filter) {
return new \WP_REST_Response([
'error_message' => __('A filter with this ID was not found', 'tainacan' ),
'filter_id' => $filter_id
'filter_id' => $request['filter_id']
], 400);
}
@ -463,26 +457,60 @@ class REST_Filters_Controller extends REST_Controller {
*
* @return array|mixed
*/
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->filter_repository->get_map();
public function get_endpoint_args_for_item_schema( $method = null, $is_collection_level = false ) {
$endpoint_args = [
'filter_id' => [
'description' => __( 'Filter ID', 'tainacan' ),
'required' => true,
]
];
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
if ( $is_collection_level )
$endpoint_args['collection_id'] = [
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
];
// Show only args that has a method set
if( !method_exists(new Entities\Filter(), "$set_") ){
unset($map[$mapped]);
switch ( $method ) {
case \WP_REST_Server::READABLE:
$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;
@ -513,25 +541,20 @@ class REST_Filters_Controller extends REST_Controller {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'filter',
'type' => 'object'
'type' => 'object',
'tags' => [ $this->rest_base ],
];
$main_schema = parent::get_repository_schema( $this->filter_repository );
$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(
parent::get_base_properties_schema(),
$main_schema,
$permissions_schema
// $collection_scheme,
// $metadatum_scheme
);
return $schema;
}
}
?>

View File

@ -11,6 +11,9 @@ use Tainacan\Entities;
*
* */
class REST_Importers_Controller extends REST_Controller {
protected function get_schema() {
return "TODO:get_schema";
}
/**
* REST_Importers_Controller constructor.

View File

@ -7,6 +7,7 @@ use Tainacan\Entities;
use Tainacan\Repositories;
class REST_Item_Metadata_Controller extends REST_Controller {
private $metadatum;
private $item_metadata_repository;
private $item_repository;
@ -46,6 +47,16 @@ class REST_Item_Metadata_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item_metadatum_value'),
'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(
'methods' => \WP_REST_Server::EDITABLE,
@ -56,8 +67,10 @@ class REST_Item_Metadata_Controller extends REST_Controller {
array(
'methods' => \WP_REST_Server::DELETABLE,
'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',
@ -67,18 +80,29 @@ class REST_Item_Metadata_Controller extends REST_Controller {
'callback' => array($this, 'get_items'),
'permission_callback' => array($this, 'get_items_permissions_check'),
'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]+)',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'permission_callback' => array($this, 'get_items_permissions_check'),
),
)
);
array(
'methods' => \WP_REST_Server::READABLE,
'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
*/
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,
$this->get_wp_query_params()
);
} elseif ($method === \WP_REST_Server::EDITABLE) {
$endpoint_args['metadatum_id'] = [
'description' => __( 'Item ID', 'tainacan' ),
'required' => true,
];
$endpoint_args['values'] = [
'type' => ['array', 'string', 'object', 'integer'],
'items' => [
'type' => ['array', 'string', 'object', 'integer']
],
'items' => [ 'type' => ['array', 'string', 'object', 'integer'] ],
'description' => __('The value(s) of item metadata')
];
$endpoint_args['parent_meta_id'] = [
'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')
];
} elseif ($method === \WP_REST_Server::DELETABLE) {
$endpoint_args['metadatum_id'] = [
'description' => __( 'Item ID', 'tainacan' ),
'required' => true,
];
}
return $endpoint_args;
@ -392,11 +428,48 @@ class REST_Item_Metadata_Controller extends REST_Controller {
}
private function get_metadata_value($is_multiple, $value) {
if ($is_multiple) {
if ( $is_multiple )
return $value;
} elseif (is_array($value)) {
elseif ( is_array($value) )
return implode(' ', $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;
}
}

View File

@ -17,6 +17,9 @@ class REST_Items_Controller extends REST_Controller {
private $item_metadata;
private $collections_repository;
private $metadatum_repository;
private $terms_repository;
private $filters_repository;
private $taxonomy_repository;
/**
* REST_Items_Controller constructor.
@ -53,7 +56,14 @@ class REST_Items_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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(
'methods' => \WP_REST_Server::CREATABLE,
@ -61,6 +71,7 @@ class REST_Items_Controller extends REST_Controller {
'permission_callback' => array($this, 'create_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
),
'schema' => [$this, 'get_list_schema'],
)
);
register_rest_route(
@ -82,13 +93,9 @@ class REST_Items_Controller extends REST_Controller {
'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', 'tainacan'),
'default' => '0'
),
)
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::DELETABLE),
),
'schema' => [$this, 'get_schema'],
)
);
register_rest_route(
@ -98,7 +105,14 @@ class REST_Items_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item_attachments'),
'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'],
)
@ -112,6 +126,7 @@ class REST_Items_Controller extends REST_Controller {
'permission_callback' => array($this, 'get_items_permissions_check'),
'args' => $this->get_wp_query_params(),
),
'schema' => [$this, 'get_list_schema'],
)
);
register_rest_route(
@ -122,6 +137,14 @@ class REST_Items_Controller extends REST_Controller {
'callback' => array($this, 'duplicate_item'),
'permission_callback' => array($this, 'create_item_permissions_check'),
'args' => array(
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'type' => 'string',
],
'item_id' => [
'description' => __( 'Item ID', 'tainacan' ),
'type' => 'string',
],
'copies' => array(
'description' => __('Number of copies to be created', 'tainacan'),
'default' => 1,
@ -129,10 +152,13 @@ class REST_Items_Controller extends REST_Controller {
),
'status' => array(
'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(
@ -144,6 +170,7 @@ class REST_Items_Controller extends REST_Controller {
'permission_callback' => array($this, 'submission_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
),
'schema' => [$this, 'get_schema']
)
);
register_rest_route(
@ -153,7 +180,18 @@ class REST_Items_Controller extends REST_Controller {
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'submission_item_finish'),
'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
*/
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) {
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'description' => 'The context in which the request is made.',
'enum' => array(
'view',
'edit'
),
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_fetch_only_param()
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->items_repository->get_map();
switch ( $method ) {
case \WP_REST_Server::READABLE:
$endpoint_args['context'] = array(
'type' => 'string',
'default' => 'view',
'description' => __( 'Scope under which the request is made; determines fields present in response.', 'tainacan' ),
'enum' => array(
'view',
'edit'
),
);
$endpoint_args = array_merge(
$endpoint_args,
parent::get_fetch_only_param()
);
break;
case \WP_REST_Server::CREATABLE:
case \WP_REST_Server::EDITABLE:
$map = $this->items_repository->get_map();
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
// Show only args that has a method set
if( !method_exists($this->item, "$set_") ){
unset($map[$mapped]);
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
// Show only args that has a method set
if( !method_exists($this->item, "$set_") ){
unset($map[$mapped]);
}
}
}
$endpoint_args = $map;
$endpoint_args = array_merge(
$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;
@ -1501,14 +1560,13 @@ class REST_Items_Controller extends REST_Controller {
return $query_params;
}
function get_attachments_schema() {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'collection',
'type' => 'object'
];
function process_request_filters($args) {
return $this->prepare_filters($args);
}
$schema = [
function get_attachments_schema() {
$properties = [
'title' => [
'description' => esc_html__('The attachment title', 'tainacan'),
'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(
parent::get_base_properties_schema(),
$schema
$main_schema,
$permissions_schema
);
return $schema;
}
function process_request_filters($args) {
return $this->prepare_filters($args);
}
}

View File

@ -28,7 +28,7 @@ class REST_Logs_Controller extends REST_Controller {
'permission_callback' => array($this, 'get_items_permissions_check'),
'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]+)',
@ -37,6 +37,12 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => array(
'log_id' => array(
'description' => __( 'Log ID', 'tainacan' ),
'required' => true,
),
)
),
'schema' => [$this, 'get_schema']
)
@ -47,9 +53,17 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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,
@ -58,9 +72,17 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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,
@ -69,9 +91,17 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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,
@ -80,9 +110,17 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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,
@ -91,9 +129,17 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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,
@ -102,9 +148,17 @@ class REST_Logs_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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 ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()
);
switch ( $method ) {
case \WP_REST_Server::READABLE:
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()
);
break;
}
return $endpoint_args;
@ -348,7 +405,8 @@ class REST_Logs_Controller extends REST_Controller {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'log',
'type' => 'object'
'type' => 'object',
'tags' => [ $this->rest_base ]
];
$main_schema = parent::get_repository_schema( $this->logs_repository );

View File

@ -7,8 +7,6 @@ use Tainacan\Entities;
use Tainacan\Repositories;
class REST_Metadata_Controller extends REST_Controller {
private $item_metadata_repository;
private $item_repository;
private $collection_repository;
private $metadatum_repository;
@ -25,8 +23,6 @@ class REST_Metadata_Controller extends REST_Controller {
*/
public function init_objects() {
$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();
}
@ -48,7 +44,15 @@ class REST_Metadata_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'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(
'type' => 'string',
'default' => 'view',
@ -58,18 +62,19 @@ class REST_Metadata_Controller extends REST_Controller {
'edit'
)
),
),
],
),
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => array($this, 'update_item'),
'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(
'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, true)
),
'schema' => [$this, 'get_schema']
)
@ -80,15 +85,23 @@ class REST_Metadata_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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(
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'create_item'),
'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,
@ -105,7 +118,7 @@ class REST_Metadata_Controller extends REST_Controller {
'permission_callback' => array($this, 'create_item_permissions_check'),
'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]+)',
@ -114,17 +127,12 @@ class REST_Metadata_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => array(
'context' => array(
'type' => 'string',
'default' => 'view',
'description' => 'The context in which the request is made.',
'enum' => array(
'view',
'edit'
)
),
),
'args' => [
'metadatum_id' => [
'description' => __( 'Metadatum ID', 'tainacan' ),
'required' => true,
],
],
),
array(
'methods' => \WP_REST_Server::EDITABLE,
@ -135,7 +143,8 @@ class REST_Metadata_Controller extends REST_Controller {
array(
'methods' => \WP_REST_Server::DELETABLE,
'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'],
)
@ -582,26 +591,57 @@ class REST_Metadata_Controller extends REST_Controller {
* @return array
* @throws \Exception
*/
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->metadatum_repository->get_map();
public function get_endpoint_args_for_item_schema( $method = null, $is_collection_level = false ) {
$endpoint_args = [
'metadatum_id' => [
'description' => __( 'Metadatum ID', 'tainacan' ),
'required' => true,
]
];
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
if ( $is_collection_level )
$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
if( !method_exists(new Entities\Metadatum(), "$set_") ){
unset($map[$mapped]);
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
// Show only args that has a method set
if ( !method_exists(new Entities\Metadatum(), "$set_") ){
unset($map[$mapped]);
}
}
}
$endpoint_args = $map;
$endpoint_args = array_merge(
$endpoint_args,
$map
);
if ( $method === \WP_REST_Server::CREATABLE )
unset($endpoint_args['metadatum_id']);
break;
}
return $endpoint_args;
@ -611,23 +651,17 @@ class REST_Metadata_Controller extends REST_Controller {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'metadatum',
'type' => 'object'
'type' => 'object',
'tags' => [ $this->rest_base ],
];
$main_schema = parent::get_repository_schema( $this->metadatum_repository );
$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(
parent::get_base_properties_schema(),
$main_schema,
$permissions_schema
// $item_metadata_scheme,
// $item_scheme,
// $collection_scheme
);
return $schema;

View File

@ -7,6 +7,11 @@ use Tainacan\Entities;
use Tainacan\Repositories;
class REST_Metadata_Sections_Controller extends REST_Controller {
private $metadata_sections_repository;
private $metadata_repository;
private $collection_repository;
public function __construct() {
parent::__construct();
$this->rest_base = 'metadata-sections';
@ -42,7 +47,15 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'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(
'type' => 'string',
'default' => 'view',
@ -52,7 +65,7 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
'edit'
)
),
),
],
),
array(
'methods' => \WP_REST_Server::EDITABLE,
@ -64,6 +77,7 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
'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']
)
@ -74,7 +88,15 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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(
'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'),
'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',
@ -102,10 +124,10 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
array(
'methods' => \WP_REST_Server::DELETABLE,
'callback' => array($this, 'delete_metadata'),
'permission_callback' => array($this, 'update_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE),
'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_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['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',
);
@ -610,51 +632,80 @@ class REST_Metadata_Sections_Controller extends REST_Controller {
* @throws \Exception
*/
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->metadata_sections_repository->get_map();
$endpoint_args = [
'metadata_section_id' => [
'description' => __( 'Metadata Section ID', 'tainacan' ),
'required' => true,
],
'collection_id' => [
'description' => __( 'Collection ID', 'tainacan' ),
'required' => true,
]
];
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
switch ( $method ) {
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
if( !method_exists(new Entities\Metadatum(), "$set_") ){
unset($map[$mapped]);
foreach ($map as $mapped => $value){
$set_ = 'set_'. $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;
}
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() {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'metadatum',
'type' => 'object'
'title' => 'metadata-section',
'type' => 'object',
'tags' => [ $this->rest_base ],
];
$main_schema = parent::get_repository_schema( $this->metadata_sections_repository );
$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(
parent::get_base_properties_schema(),
$main_schema,
$permissions_schema
// $item_metadata_scheme,
// $item_scheme,
// $collection_scheme
);
return $schema;

View File

@ -21,47 +21,8 @@ class REST_Metadata_Types_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'permission_callback' => array($this, 'get_items_permissions_check'),
'args' => [
'metadata-type' => [
'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'
],
]
]
]
)
),
'schema' => [$this, 'get_list_schema']
)
);
}
@ -107,6 +68,71 @@ class REST_Metadata_Types_Controller extends REST_Controller {
public function get_items_permissions_check( $request ) {
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;
}
}
?>

View File

@ -6,6 +6,9 @@ use \Tainacan\API\REST_Controller;
use Tainacan\Entities\Metadatum;
class REST_Metadatum_Mappers_Controller extends REST_Controller {
protected function get_schema() {
return "TODO:get_schema";
}
/**
* REST_Metadatum_Mappers_Controller constructor.

View File

@ -34,8 +34,10 @@ class REST_Oaipmh_Expose_Controller extends REST_Controller {
array(
'methods' => \WP_REST_Server::READABLE,
'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;
}
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;
}
}

View File

@ -8,6 +8,10 @@ use Tainacan\Repositories;
class REST_Reports_Controller extends REST_Controller {
private $taxonomy_repository;
private $metadatum_repository;
private $collections_repository;
public function __construct() {
$this->rest_base = 'reports';
parent::__construct();
@ -15,7 +19,6 @@ class REST_Reports_Controller extends REST_Controller {
}
public function init_objects() {
$this->items_repository = Repositories\Items::get_instance();
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
$this->metadatum_repository = Repositories\Metadata::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,
'callback' => array($this, 'get_collections'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => $this->get_endpoint_args_for_item_schema()
),
'schema' => array($this, 'get_collection_schema'),
)
);
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,
'callback' => array($this, 'get_summary'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => array_merge(
array(
'collection_id' => array(
'description' => __('Collection ID.', 'tainacan'),
'required' => true,
),
),
$this->get_endpoint_args_for_item_schema()
)
),
'schema' => array($this, 'get_collection_summary_schema'),
)
);
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,
'callback' => array($this, 'get_stats_collection_metadata'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => array_merge(
array(
'collection_id' => array(
'description' => __('Collection ID.', 'tainacan'),
'required' => true,
),
),
$this->get_endpoint_args_for_item_schema()
)
),
'schema' => array($this, 'get_metadata_schema'),
)
);
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,
'callback' => array($this, 'get_stats_collection_metadata'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => $this->get_endpoint_args_for_item_schema()
),
'schema' => array($this, 'get_metadata_schema'),
)
);
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,
'callback' => array($this, 'get_summary'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => $this->get_endpoint_args_for_item_schema()
),
'schema' => array($this, 'get_summary_schema'),
)
);
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,
'callback' => array($this, 'get_taxonomies_list'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => $this->get_endpoint_args_for_item_schema()
),
'schema' => array($this, 'get_taxonomy_schema'),
)
);
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,
'callback' => array($this, 'get_taxonomy'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
'args' => array_merge(
array(
'taxonomy_id' => array(
'description' => __('Taxonomy ID.', 'tainacan'),
'required' => true,
),
),
$this->get_endpoint_args_for_item_schema()
)
),
'schema' => array($this, 'get_taxonomy_terms_schema'),
)
);
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,
'callback' => array($this, 'get_activities'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'start' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time',
],
'end' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
'args' => array_merge(
[
'start' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time',
],
'end' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
],
],
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
$this->get_endpoint_args_for_item_schema()
)
),
'schema' => array($this, 'get_activities_schema'),
)
);
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,
'callback' => array($this, 'get_activities'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'start' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time',
],
'end' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
'args' => array_merge(
[
'collection_id' => [
'description' => __('Collection ID.', 'tainacan'),
'required' => true,
],
'start' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time',
],
'end' => [
'title' => __( 'start Date', 'tainacan' ),
'type' => 'string',
'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8
],
],
'force' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
$this->get_endpoint_args_for_item_schema()
)
),
'schema' => array($this, 'get_activities_schema'),
)
);
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,
'callback' => array($this, 'get_metadata'),
'permission_callback' => array($this, 'reports_permissions_check'),
'args' => [
'parent' => [
'title' => __( 'parent', 'tainacan' ),
'type' => 'integer',
'args' => array_merge(
[
'parent' => [
'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' => [
'title' => __( 'Force regenerate', 'tainacan' ),
'type' => 'string',
'default' => 'no',
'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ),
'enum' => array(
'no',
'yes'
)
]
]
$this->get_endpoint_args_for_item_schema()
)
),
'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');
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;
}
}
?>

View File

@ -3,8 +3,6 @@
namespace Tainacan\API\EndPoints;
use \Tainacan\API\REST_Controller;
use Tainacan\Entities;
use Tainacan\Repositories;
class REST_Roles_Controller extends REST_Controller {
@ -32,54 +30,34 @@ class REST_Roles_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_items'),
'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(
'methods' => \WP_REST_Server::CREATABLE,
'callback' => array($this, 'create_item'),
'permission_callback' => array($this, 'create_item_permissions_check'),
'args' => array(
'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']
),
)
'args' => $this->get_endpoint_args(\WP_REST_Server::CREATABLE)
),
'schema' => [$this, 'get_schema']
'schema' => [$this, 'get_list_schema']
));
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<role>[a-z0-9-_]+)', array(
array(
'methods' => \WP_REST_Server::DELETABLE,
'callback' => array($this, 'delete_item'),
'permission_callback' => array($this, 'delete_item_permissions_check'),
'args' => $this->get_endpoint_args(\WP_REST_Server::DELETABLE)
),
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => array($this, 'update_item'),
'permission_callback' => array($this, 'update_item_permissions_check'),
'args' => array(
'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']
),
)
'args' => $this->get_endpoint_args(\WP_REST_Server::EDITABLE)
),
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => $this->get_endpoint_args(\WP_REST_Server::READABLE)
),
'schema' => [$this, 'get_schema']
));
@ -90,7 +68,15 @@ class REST_Roles_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_capabilities'),
'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(
$this->namespace, '/capabilities',
@ -99,7 +85,8 @@ class REST_Roles_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_capabilities'),
'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);
}
$role = $roles[$role_slug];
if ( isset($request['name']) ) {
$name = esc_html( esc_sql( $request['name'] ) );
@ -470,6 +455,56 @@ class REST_Roles_Controller extends REST_Controller {
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
*
@ -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() {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'filter',
'type' => 'object'
'title' => $this->rest_base,
'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;
}
}
?>

View File

@ -5,10 +5,12 @@ namespace Tainacan\API\EndPoints;
use \Tainacan\API\REST_Controller;
use Tainacan\Entities;
use Tainacan\Repositories;
use Tainacan\Entities\Entity;
class REST_Sequence_Edit_Controller extends REST_Controller {
private $items_repository;
private $collections_repository;
public function __construct() {
$this->rest_base = 'sequence-edit';
parent::__construct();
@ -34,6 +36,7 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
'permission_callback' => array($this, 'sequence_edit_permissions_check'),
'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]+)',
@ -42,7 +45,9 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'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]+)',
@ -51,7 +56,9 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item_in_sequence'),
'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) {
$query_params['collection_id'] = [
'type' => 'string',
'description' => __( 'Collection ID', 'tainacan' ),
];
$query_params['items_ids'] = [
'type' => 'array',
'items' => ['type' => 'integer'],
@ -199,6 +211,71 @@ class REST_Sequence_Edit_Controller extends REST_Controller {
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;
}
}
?>

View File

@ -25,7 +25,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
public function init_objects() {
$this->taxonomy = new Entities\Taxonomy();
$this->taxonomy_repository = Repositories\Taxonomies::get_instance();
$this->collections_repository = Repositories\Collections::get_instance();
}
public function register_routes() {
@ -44,7 +43,7 @@ class REST_Taxonomies_Controller extends REST_Controller {
'permission_callback' => array($this, 'create_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE)
),
'schema' => [$this, 'get_schema']
'schema' => [$this, 'get_list_schema']
)
);
register_rest_route(
@ -55,6 +54,10 @@ class REST_Taxonomies_Controller extends REST_Controller {
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => array(
'taxonomy_id' => array(
'description' => __( 'Taxonomy ID', 'tainacan' ),
'required' => true,
),
'context' => array(
'type' => 'string',
'default' => 'view',
@ -64,21 +67,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
'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(
@ -87,6 +75,12 @@ class REST_Taxonomies_Controller extends REST_Controller {
'permission_callback' => array($this, 'update_item_permissions_check'),
'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']
)
);
@ -97,7 +91,15 @@ class REST_Taxonomies_Controller extends REST_Controller {
'methods' => \WP_REST_Server::EDITABLE,
'callback' => array($this, 'update_item'),
'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']
)
@ -497,26 +499,62 @@ class REST_Taxonomies_Controller extends REST_Controller {
* @return array|mixed
*/
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params(),
parent::get_fetch_only_param()
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->taxonomy_repository->get_map();
$endpoint_args = [
'taxonomy_id' => [
'description' => __( 'Taxonomy ID', 'tainacan' ),
'required' => true,
]
];
switch ( $method ) {
case \WP_REST_Server::READABLE:
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
$endpoint_args['fetch_only'] = array(
'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
if( !method_exists($this->taxonomy, "$set_") ){
unset($map[$mapped]);
foreach ($map as $mapped => $value){
$set_ = 'set_'. $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;
@ -549,7 +587,8 @@ class REST_Taxonomies_Controller extends REST_Controller {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'taxonomy',
'type' => 'object'
'type' => 'object',
'tags' => [ $this->rest_base ]
];
$main_schema = parent::get_repository_schema( $this->taxonomy_repository );
@ -562,7 +601,6 @@ class REST_Taxonomies_Controller extends REST_Controller {
);
return $schema;
}
}

View File

@ -40,7 +40,7 @@ class REST_Terms_Controller extends REST_Controller {
'permission_callback' => array($this, 'create_item_permissions_check'),
'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,
@ -63,25 +63,27 @@ class REST_Terms_Controller extends REST_Controller {
'permission_callback' => array($this, 'delete_items_permissions_check'),
'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]+)' ,
array(
array(
'methods' => \WP_REST_Server::DELETABLE,
'callback' => array($this, 'delete_item'),
'permission_callback' => array($this, 'delete_item_permissions_check'),
'args' => [
'permanently' => [
'description' => __('Delete term permanently.'),
'default' => '1'
],
'delete_child_terms' => [
'description' => __('Delete all child terms.'),
'default' => false
],
]
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => array(
'taxonomy_id' => array(
'description' => __( 'Taxonomy ID', 'tainacan' ),
'required' => true,
'type' => ['integer', 'string'],
),
'term_id' => array(
'description' => __( 'Term ID', 'tainacan' ),
'type' => ['integer', 'string'],
'required' => true,
)
)
),
array(
'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)
),
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array($this, 'get_item'),
'permission_callback' => array($this, 'get_item_permissions_check'),
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
'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']
)
@ -104,9 +106,18 @@ class REST_Terms_Controller extends REST_Controller {
'methods' => \WP_REST_Server::EDITABLE,
'callback' => array($this, 'update_parent_terms'),
'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
*/
public function get_endpoint_args_for_item_schema( $method = null ) {
$endpoint_args = [];
if($method === \WP_REST_Server::READABLE) {
$endpoint_args = array_merge(
$endpoint_args,
parent::get_wp_query_params()
);
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
$map = $this->terms_repository->get_map();
$endpoint_args = [
'taxonomy_id' => [
'description' => __( 'Taxonomy ID', 'tainacan' ),
'required' => true,
'type' => ['integer', 'string'],
],
'term_id' => [
'description' => __( 'Term ID', 'tainacan' ),
'type' => ['integer', 'string'],
'required' => true,
]
];
foreach ($map as $mapped => $value){
$set_ = 'set_'. $mapped;
switch ( $method ) {
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
if( !method_exists($this->term, "$set_") ){
unset($map[$mapped]);
$map = $this->terms_repository->get_map();
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) {
$endpoint_args['metadatum_id'] = [
'required' => false,
'type' => 'integer',
'description' => __('If term is being created in the context of a Taxonomy metadatum, specify its ID')
if ( $method === \WP_REST_Server::CREATABLE ) {
unset($endpoint_args['term_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'] = [
'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')
$endpoint_args['delete_child_terms'] = [
'description' => __('Delete all child terms.'),
'default' => false
];
}
break;
}
return $endpoint_args;
@ -709,6 +752,12 @@ class REST_Terms_Controller extends REST_Controller {
* @return array
*/
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 = array_merge($query_params, parent::get_wp_query_params());
@ -727,19 +776,17 @@ class REST_Terms_Controller extends REST_Controller {
$schema = [
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'term',
'type' => 'object'
'type' => 'object',
'tags' => [ $this->rest_base ]
];
$main_schema = parent::get_repository_schema( $this->terms_repository );
$permissions_schema = parent::get_permissions_schema();
// $taxonomy_scheme = parent::get_repository_schema( $this->taxonomy_repository );
$schema['properties'] = array_merge(
parent::get_base_properties_schema(),
$main_schema,
$permissions_schema
// $taxonomy_scheme
);
return $schema;

View File

@ -1,8 +1,13 @@
<?php
/**
* Base namespace for all rest api requests. WordPress default is 'wp/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_terms_controller = new \Tainacan\API\EndPoints\REST_Terms_Controller();
$rest_logs_controller = new \Tainacan\API\EndPoints\REST_Logs_Controller();

View File

@ -14,7 +14,6 @@ class Filter extends Entity {
$name,
$description,
$order,
$color,
$metadatum,
$metadatum_id,
$max_options,
@ -85,14 +84,6 @@ class Filter extends Entity {
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
@ -219,16 +210,6 @@ class Filter extends Entity {
$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
*

View File

@ -765,9 +765,11 @@ class Item extends Entity {
$before = str_replace('$id', ' id="metadata-id-' . $item_metadatum->get_metadatum()->get_id() . '"', $before);
// 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--type-' . $item_metadatum->get_metadatum()->get_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--type-$metadata_type", $before, $item_metadatum );
$before = apply_filters( "tainacan-get-item-metadatum-as-html-before--id-$metadatum_id", $before, $item_metadatum );
if ( is_numeric($metadatum_index) ) {
$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) ) {
$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 );
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--type-' . $item_metadatum->get_metadatum()->get_metadata_type(), $after, $item_metadatum );
$metadata_type = $item_metadatum->get_metadatum()->get_metadata_type();
$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 );
// Closes the wrapper

View File

@ -21,7 +21,6 @@ class Metadatum extends Entity {
$display,
$cardinality,
$collection_key,
$mask,
$default_value,
$metadata_type,
$metadata_type_options,
@ -168,15 +167,6 @@ class Metadatum extends Entity {
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
*
@ -381,15 +371,6 @@ class Metadatum extends Entity {
$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

View File

@ -1,7 +1,7 @@
<?php
namespace Tainacan;
use Tainacan\Mappers_Hanlder;
use Tainacan\Mappers_Handler;
use Tainacan\Mappers\Mapper;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );

View File

@ -27,54 +27,55 @@ class Collections extends Repository {
* @see \Tainacan\Repositories\Repository::get_map()
*/
protected function _get_map() {
return apply_filters( 'tainacan-get-map-' . $this->get_name(), [
'name' => [
$entity = $this->get_name();
return apply_filters( "tainacan-get-map-$entity", [
'name' => [
'map' => 'post_title',
'title' => __( 'Name', 'tainacan' ),
'type' => 'string',
'description' => __( 'The title of the collection', 'tainacan' ),
'validation' => v::stringType()->notEmpty(),
],
'status' => [
'status' => [
'map' => 'post_status',
'title' => __( 'Status', 'tainacan' ),
'type' => 'string',
'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' )
],
'author_id' => [
'author_id' => [
'map' => 'post_author',
'title' => __( 'Author ID', 'tainacan' ),
'type' => 'string',
'description' => __( 'The collection author\'s user ID (numeric string)', 'tainacan' )
],
'creation_date' => [
'creation_date' => [
'map' => 'post_date',
'title' => __( 'Creation Date', 'tainacan' ),
'type' => 'string',
'description' => __( 'The collection creation date', 'tainacan' )
],
'modification_date' => [
'modification_date' => [
'map' => 'post_modified',
'title' => __( 'Modification Date', 'tainacan' ),
'type' => 'string',
'description' => __( 'The collection modification date', 'tainacan' )
],
'order' => [
'order' => [
'map' => 'order',
'title' => __( 'Order', 'tainacan' ),
'type' => 'string',
'description' => __( 'Collection order. This metadata is used if collections are manually ordered.', 'tainacan' ),
//'validation' => v::stringType(),
],
'parent' => [
'parent' => [
'map' => 'post_parent',
'title' => __( 'Parent Collection', 'tainacan' ),
'type' => 'integer',
'description' => __( 'Original collection from which features are inherited', 'tainacan' ),
//'validation' => v::stringType(),
],
'description' => [
'description' => [
'map' => 'post_content',
'title' => __( 'Description', 'tainacan' ),
'type' => 'string',
@ -82,14 +83,14 @@ class Collections extends Repository {
'default' => '',
//'validation' => v::stringType(),
],
'slug' => [
'slug' => [
'map' => 'post_name',
'title' => __( 'Slug', 'tainacan' ),
'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' ),
//'validation' => v::stringType(),
],
'default_orderby' => [
'default_orderby' => [
'map' => 'meta',
'title' => __( 'Default order metadata', 'tainacan' ),
'type' => ['string', 'array', 'object'],
@ -97,12 +98,13 @@ class Collections extends Repository {
'default' => 'date',
//'validation' => v::stringType(),
],
'default_order' => [
'default_order' => [
'map' => 'meta',
'title' => __( 'Default order', 'tainacan' ),
'description' => __( 'Default order for items in this collection. ASC or DESC', 'tainacan' ),
'type' => 'string',
'default' => 'ASC',
'enum' => [ 'ASC', 'DESC' ],
'validation' => v::stringType()->in( [ 'ASC', 'DESC' ] ),
],
'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' ),
//'validation' => v::stringType(),
],
'default_view_mode' => [
'default_view_mode' => [
'map' => 'meta',
'title' => __( 'Default view mode', 'tainacan' ),
'type' => 'string',
@ -122,7 +124,7 @@ class Collections extends Repository {
'default' => 'table',
//'validation' => v::stringType(),
],
'enabled_view_modes' => [
'enabled_view_modes' => [
'map' => 'meta',
'title' => __( 'Enabled view modes', 'tainacan' ),
'type' => 'array',
@ -131,27 +133,81 @@ class Collections extends Repository {
'items' => [ 'type' => 'string' ],
//'validation' => v::stringType(),
],
'metadata_section_order' => [
'metadata_section_order' => [
'map' => 'meta',
'title' => __( 'Metadata order', 'tainacan' ),
'type' => ['array', 'object', 'string'],
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
'type' => 'array',
'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' ),
],
'metadata_order' => [
'map' => 'meta',
'title' => __( 'Metadata order', 'tainacan' ),
'type' => ['array', 'object', 'string'],
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
'type' => 'array',
'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(),
],
'filters_order' => [
'map' => 'meta',
'title' => __( 'Filters order', 'tainacan' ),
'type' => ['array', 'object', 'string'],
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
'type' => 'array',
'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(),
],
'enable_cover_page' => [
@ -160,6 +216,7 @@ class Collections extends Repository {
'type' => 'string',
'description' => __( 'To use this page as the home page of this collection', 'tainacan' ),
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'default' => 'no'
],
@ -184,7 +241,8 @@ class Collections extends Repository {
'_thumbnail_id' => [
'map' => 'meta',
'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' => [
'map' => 'comment_status',
@ -192,7 +250,8 @@ class Collections extends Repository {
'type' => 'string',
'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()),
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
'enum' => [ 'open', 'closed' ],
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
],
'allow_comments' => [
'map' => 'meta',
@ -200,30 +259,33 @@ class Collections extends Repository {
'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' ),
'default' => 'closed',
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
'enum' => [ 'open', 'closed' ],
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
],
'submission_anonymous_user' => [
'map' => 'meta',
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
'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' ),
'default' => 'no',
'map' => 'meta',
'title' => __( 'Allows submission by anonymous user', 'tainacan' ),
'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' ),
'default' => 'no',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'submission_default_status' => [
'map' => 'meta',
'title' => __( 'Default submission item status', 'tainacan' ),
'type' => 'string',
'description' => __( 'The default status of the item that will be created in the collection after submission.', 'tainacan' ),
'default' => 'draft'
'map' => 'meta',
'title' => __( 'Default submission item status', 'tainacan' ),
'type' => 'string',
'description' => __( 'The default status of the item that will be created in the collection after submission.', 'tainacan' ),
'default' => 'draft'
],
'allows_submission' => [
'map' => 'meta',
'title' => __( 'Allows item submission', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, the collection allows item submission, for example via the Item Submission block.', 'tainacan' ),
'default' => 'no',
'map' => 'meta',
'title' => __( 'Allows item submission', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, the collection allows item submission, for example via the Item Submission block.', 'tainacan' ),
'default' => 'no',
'enum' => [ 'yes', 'no' ],
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
@ -233,24 +295,40 @@ class Collections extends Repository {
'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' ),
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'default' => 'no'
],
'submission_use_recaptcha' => [
'map' => 'meta',
'title' => __( 'Use reCAPTCHA verification on submission form', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, the collection allows item submission using a reCAPTCHA', 'tainacan' ),
'default' => 'no',
'map' => 'meta',
'title' => __( 'Use reCAPTCHA verification on submission form', 'tainacan' ),
'type' => 'string',
'description' => __( 'If enabled, the collection allows item submission using a reCAPTCHA', 'tainacan' ),
'default' => 'no',
'on_error' => __( 'Value should be yes or no', 'tainacan' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
],
'default_metadata_section_properties' => [
'default_metadata_section_properties' => [
'map' => 'meta',
'title' => __( 'Default metadata section properties', 'tainacan' ),
'type' => 'object',
'items' => [ 'name' => 'string', 'description' => 'string', 'description_bellow_name' => 'string' ],
'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' ]
]
]
],
] );
}

View File

@ -29,7 +29,8 @@ class Filters extends Repository {
}
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' => [
'map' => 'post_title',
'title' => __( 'Name', 'tainacan' ),
@ -41,7 +42,7 @@ class Filters extends Repository {
'order' => [
'map' => 'menu_order',
'title' => __( 'Order', 'tainacan' ),
'type' => 'string/integer',
'type' => ['string', 'integer'],
'description' => __( 'Filter order. This metadata is used if filters were manually ordered.', 'tainacan' ),
'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' ),
'on_error' => __( 'Please set the "Begin with filter collapsed" value as "yes" or "no"', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'collection_id' => [
@ -84,13 +86,6 @@ class Filters extends Repository {
'description' => __( 'The collection ID', 'tainacan' ),
'validation' => ''
],
'color' => [
'map' => 'meta',
'title' => __( 'Color', 'tainacan' ),
'type' => ['integer', 'string'],
'description' => __( 'Filter color', 'tainacan' ),
'validation' => ''
],
'metadatum_id' => [
'map' => 'meta',
'title' => __( 'Metadata', 'tainacan' ),

View File

@ -32,7 +32,8 @@ class Items extends Repository {
}
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' => [
'map' => 'post_title',
'title' => __( 'Title', 'tainacan' ),
@ -86,6 +87,7 @@ class Items extends Repository {
'title' => __( 'Term IDs', 'tainacan' ),
'type' => 'array',
'description' => __( 'The item term IDs', 'tainacan' ),
'items' => [ 'type' => ['string', 'integer'] ],
],
'document_type' => [
'map' => 'meta',
@ -93,6 +95,7 @@ class Items extends Repository {
'type' => 'string',
'description' => __( 'The document type, can be a local attachment, an external URL or a text', 'tainacan' ),
'on_error' => __( 'Invalid document type', 'tainacan' ),
'enum' => [ 'attachment', 'url', 'text', 'empty' ],
'validation' => v::stringType()->in( [ 'attachment', 'url', 'text', 'empty' ] ),
'default' => 'empty'
],
@ -141,7 +144,8 @@ class Items extends Repository {
'_thumbnail_id' => [
'map' => 'meta',
'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' => [
'map' => 'comment_status',
@ -149,6 +153,7 @@ class Items extends Repository {
'type' => 'string',
'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()),
'enum' => [ 'open', 'closed' ],
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
],
] );

View File

@ -46,7 +46,8 @@ class Logs extends Repository {
}
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' => [
'map' => 'post_title',
'title' => __( 'Title', 'tainacan' ),
@ -59,7 +60,7 @@ class Logs extends Repository {
'map' => 'post_date',
'title' => __( 'Log date', 'tainacan' ),
'type' => 'string',
'description' => __( 'The log date', 'tainacan' ),
'description' => __( 'The moment when the log was registered', 'tainacan' ),
],
'description' => [
'map' => 'post_content',
@ -86,6 +87,7 @@ class Logs extends Repository {
'item_id' => [
'map' => 'meta',
'title' => __( 'Item ID', 'tainacan' ),
'description' => __( 'Item ID', 'tainacan' ),
'type' => 'integer',
],
// 'value' => [
@ -98,34 +100,44 @@ class Logs extends Repository {
'log_diffs' => [ // deprecated
'map' => 'meta',
'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' => [
'map' => 'meta',
'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' => [
'map' => 'meta',
'title' => __( 'Log item relationship', 'tainacan' ),
'description' => __( 'The ID of the object that this log is related to', 'tainacan' ),
'type' => ['string', 'integer'],
],
'object_type' => [
'map' => 'meta',
'title' => __( 'Log item relationship', 'tainacan' ),
'description' => __( 'The type of the object that this log is related to', 'tainacan' ),
'type' => 'string',
],
'old_value' => [
'map' => 'meta',
'title' => __( 'Old value', 'tainacan' ),
'description' => __( 'Value of the field previous to the edition registered by the log.', 'tainacan' ),
'type' => 'string',
],
'new_value' => [
'map' => 'meta',
'title' => __( 'New value', 'tainacan' ),
'description' => __( 'Value of the field after the edition registered by the log.', 'tainacan' ),
'type' => 'string',
],
'action' => [
'map' => 'meta',
'title' => __( 'Action', 'tainacan' ),
'description' => __( 'Type of action registered by the log.', 'tainacan' ),
'type' => 'string',
]
] );
}

View File

@ -33,7 +33,8 @@ class Metadata_Sections extends Repository {
* @see \Tainacan\Repositories\Repository::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' => [
'map' => 'post_title',
'title' => __( 'Name', 'tainacan' ),
@ -68,6 +69,7 @@ class Metadata_Sections extends Repository {
'type' => 'string',
'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' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'default' => 'no'
],
@ -83,6 +85,7 @@ class Metadata_Sections extends Repository {
'type' => 'string',
'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' ),
'enum' => [ 'yes', 'no' ],
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
'default' => 'no'
],

View File

@ -51,7 +51,8 @@ class Metadata extends Repository {
* @see \Tainacan\Repositories\Repository::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' => [
'map' => 'post_title',
'title' => __( 'Name', 'tainacan' ),
@ -70,7 +71,7 @@ class Metadata extends Repository {
'order' => [
'map' => 'menu_order',
'title' => __( 'Order', 'tainacan' ),
'type' => 'string/integer',
'type' => ['string', 'integer'],
'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' ),
//'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' ),
'on_error' => __( 'Please set the "Description below name" value as "yes" or "no"', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'placeholder' => [
@ -124,6 +126,7 @@ class Metadata extends Repository {
'description' => __( 'The metadata is required. All items in this collection must fill this field', 'tainacan' ),
'on_error' => __( 'The metadata content is invalid', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'collection_key' => [
@ -133,6 +136,7 @@ class Metadata extends Repository {
'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' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'multiple' => [
@ -143,6 +147,7 @@ class Metadata extends Repository {
'on_error' => __( 'Invalid multiple metadata', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
// yes or no. It cant be multiple if its collection_key
'enum' => [ 'yes', 'no' ],
'default' => 'no'
],
'cardinality' => [
@ -153,14 +158,6 @@ class Metadata extends Repository {
'on_error' => __( 'This number of multiple metadata is not allowed', 'tainacan' ),
//'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' => [
'map' => 'meta',
'title' => __( 'Default value', 'tainacan' ),
@ -170,7 +167,7 @@ class Metadata extends Repository {
'metadata_type_options' => [ // not showed in form
'map' => 'meta',
'title' => __( 'Metadata type options', 'tainacan' ),
'type' => ['array', 'object', 'string'],
'type' => ['array', 'object'],
'items' => [ 'type' => ['array', 'string', 'integer', 'object'] ],
'description' => __( 'Specific options for metadata type', 'tainacan' ),
// 'validation' => ''
@ -205,6 +202,7 @@ class Metadata extends Repository {
'title' => __( 'Display', 'tainacan' ),
'type' => 'string',
'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' ),
'default' => 'no'
],
@ -223,6 +221,7 @@ class Metadata extends Repository {
'description' => __( 'Makes this metadatum a repository level metadatum instead of collection metadatum', 'tainacan' ),
'on_error' => __( 'Invalid value for repository metadata', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ),
'enum' => [ 'yes', 'no' ],
// yes or no. It cant be multiple if its collection_key
'default' => 'no'
],

View File

@ -56,10 +56,11 @@ abstract class Repository {
* Register hooks
*/
protected function __construct() {
$name = $this->get_name();
add_action( 'init', array( &$this, 'register_post_type' ) );
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() {
@ -630,8 +631,9 @@ abstract class Repository {
*/
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->get_post_type(), $entity, $permanent );
do_action( "tainacan-pre-delete-$post_type", $entity, $permanent );
if ($permanent === true) {
$return = wp_delete_post( $entity->get_id(), $permanent );
@ -642,8 +644,9 @@ abstract class Repository {
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->get_post_type(), $entity, $permanent );
do_action( "tainacan-deleted-$post_type", $entity, $permanent );
$return = $this->get_entity_by_post($return);

View File

@ -32,7 +32,8 @@ class Taxonomies extends Repository {
}
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' => [
'map' => 'post_title',
'title' => __( 'Name', 'tainacan' ),
@ -63,6 +64,7 @@ class Taxonomies extends Repository {
'description' => __( 'Allow/Deny the creation of new terms in the taxonomy', 'tainacan' ),
'on_error' => __( 'Invalid insertion, allowed values are ( yes/no )', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'yes'
],
'hierarchical' => [
@ -72,6 +74,7 @@ class Taxonomies extends Repository {
'description' => __( 'Allow/Deny the existence of terms children to build a hierarchy', 'tainacan' ),
'on_error' => __( 'Invalid insertion, allowed values are ( yes/no )', 'tainacan' ),
'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no
'enum' => [ 'yes', 'no' ],
'default' => 'yes'
],
'enabled_post_types' => [

View File

@ -30,7 +30,8 @@ class Terms extends Repository {
}
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' => [
'map' => 'term_id',
'title' => __( 'ID', 'tainacan' ),

View File

@ -1742,9 +1742,11 @@ class Theme_Helper {
$before = str_replace('$id', ' id="metadata-id-' . $metadatum->get_id() . '"', $before);
// 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--type-' . $metadatum->get_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--type-$metadata_type", $before, $item_metadatum );
$before = apply_filters( "tainacan-get-item-metadatum-as-html-before--id-$metadatum_id", $before, $item_metadatum );
// Renders the metadatum opener
$return .= $before;
@ -1766,8 +1768,10 @@ class Theme_Helper {
$after = $args['after'];
// Let theme authors tweak the wrapper closer
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--id-' . $metadatum->get_id(), $after, $item_metadatum );
$after = apply_filters( 'tainacan-get-item-metadatum-as-html-after--type-' . $metadatum->get_metadata_type(), $after, $item_metadatum );
$metadatum_id = $metadatum->get_id();
$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 );
// Closes the wrapper

View File

@ -1,10 +1,10 @@
=== Tainacan ===
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
Requires at least: 5.0
Tested up to: 6.2.2
Requires PHP: 5.6
Stable tag: 0.20.3
Requires at least: 5.9
Tested up to: 6.3
Requires PHP: 7.0
Stable tag: 0.20.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -4,17 +4,18 @@ Plugin Name: Tainacan
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.
Author: Tainacan.org
Version: 0.20.3
Requires at least: 5.0
Tested up to: 6.2.2
Requires PHP: 5.6
Stable tag: 0.20.3
Author URI: https://tainacan.org/
Version: 0.20.4
Requires at least: 5.9
Tested up to: 6.3
Requires PHP: 7.0
Stable tag: 0.20.4
Text Domain: tainacan
License: GPLv2 or later
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!' );
$TAINACAN_BASE_URL = plugins_url('', __FILE__);

View File

@ -296,7 +296,7 @@ abstract class Metadata_Type {
$attributes['name'] = $this->get_name();
$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['options'] = $this->get_options();
$attributes['className'] = get_class($this);

View File

@ -214,9 +214,23 @@
align-items: flex-end;
}
.field.is-horizontal :deep(.label) {
white-space: nowrap;
}
.field.is-horizontal :deep(.has-numberinput) {
margin-top: 0;
}
.modal-card-foot {
margin-top: 12px;
}
@media screen and (min-width: 769px) {
.modal-card {
max-width: 640px;
}
}
</style>

View File

@ -121,7 +121,7 @@
.modal-card {
background-color: var(--tainacan-background-color);
color: var(--tainacan-secondary);
border-radius: 10px;
border-radius: 6px;
flex-wrap: wrap;
flex-direction: row;
padding: 35px;

View File

@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "tainacan/carousel-collections-list",
"title": "Tainacan Collections Carousel",
"apiVersion": 2,
"apiVersion": 3,
"category": "tainacan-blocks",
"keywords": [ "collections", "carousel", "slider" ],
"description": "List collections on a Carousel, displaying either its thumbnail or a preview of its items.",
@ -122,5 +122,5 @@
}
},
"editorScript": "carousel-collections-list",
"editorStyle": "carousel-collections-list"
"editorStyle": ["carousel-collections-list", "tainacan-blocks-common-editor-styles" ]
}

View File

@ -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;
@ -14,12 +14,8 @@ import axios from 'axios';
import qs from 'qs';
import { ThumbnailHelperFunctions } from '../../../admin/js/utilities.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 {
collections,
content,
@ -42,7 +38,8 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
} = attributes;
// 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
setAttributes({ blockId: clientId });
@ -81,17 +78,12 @@ export default function ({ attributes, setAttributes, className, isSelected, cli
<li
key={ collection.id }
className={ 'swiper-slide collection-list-item ' + (!showCollectionThumbnail ? 'collection-list-item-grid ' : '') + (maxCollectionsPerScreen ? ' max-collections-per-screen-' + maxCollectionsPerScreen : '') }>
{ tainacan_blocks.wp_version < '5.4' ?
<IconButton
onClick={ () => removeItemOfId(collection.id) }
icon="no-alt"
label={__('Remove', 'tainacan')}/>
:
<Button
onClick={ () => removeItemOfId(collection.id) }
icon="no-alt"
label={__('Remove', 'tainacan')}/>
}
<Button
onClick={ () => removeItemOfId(collection.id) }
icon={ () => (
<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')}/>
<a
id={ isNaN(collection.id) ? collection.id : 'collection-id-' + collection.id }
href={ collection.url }>

View File

@ -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 {
content,
blockId,
@ -21,7 +21,7 @@ export default function ({ attributes, className }) {
} = attributes;
// 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
{ ...blockProps }
data-module="carousel-collections-list"

View File

@ -1,4 +1,8 @@
@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 {
display: flex;
@ -138,7 +142,7 @@
margin: 0 var(--spaceAroundCarousel, 50px);
ul.swiper-wrapper {
list-style: none;
list-style: none !important;
padding: 0;
margin: 0;
height: auto;
@ -378,7 +382,7 @@
right: -8px;
top: -8px;
border: 1px solid var(--tainacan-block-gray3, $gray3);
border-radius: 12px;
border-radius: 100em;
transition: opacity linear 0.15s, right linear 0.15s;
}
&:hover button:hover {

View File

@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "tainacan/carousel-items-list",
"title": "Tainacan Collection's Items Carousel",
"apiVersion": 2,
"apiVersion": 3,
"category": "tainacan-blocks",
"keywords": [ "items", "carousel", "slider" ],
"description": "List items on a Carousel, using search or item selection.",
@ -142,5 +142,5 @@
}
},
"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