Core title is no longer allways required (works as any other metadata)
This commit is contained in:
parent
016bba7cbc
commit
2e8cfd5dd8
|
@ -48,7 +48,10 @@ class Core_Description extends Field_Type {
|
||||||
*
|
*
|
||||||
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
||||||
* @return bool Valid or not
|
* @return bool Valid or not
|
||||||
*/
|
*
|
||||||
|
* Quarantine - Core metadata should be validated as any other metadata
|
||||||
|
* and item title is no longer mandatory
|
||||||
|
|
||||||
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||||
|
|
||||||
$item = $item_metadata->get_item();
|
$item = $item_metadata->get_item();
|
||||||
|
@ -62,6 +65,8 @@ class Core_Description extends Field_Type {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
public function validate_options( Field $field ) {
|
public function validate_options( Field $field ) {
|
||||||
|
|
||||||
if ( !in_array($field->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )
|
if ( !in_array($field->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )
|
||||||
|
|
|
@ -49,7 +49,10 @@ class Core_Title extends Field_Type {
|
||||||
*
|
*
|
||||||
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
* @param TainacanEntitiesItem_Metadata_Entity $item_metadata
|
||||||
* @return bool Valid or not
|
* @return bool Valid or not
|
||||||
*/
|
*
|
||||||
|
* Quarantine - Core metadata should be validated as any other metadata
|
||||||
|
* and item title is no longer mandatory
|
||||||
|
|
||||||
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
public function validate(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||||
|
|
||||||
$item = $item_metadata->get_item();
|
$item = $item_metadata->get_item();
|
||||||
|
@ -62,6 +65,7 @@ class Core_Title extends Field_Type {
|
||||||
return $item->validate_prop('title');
|
return $item->validate_prop('title');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function validate_options( Field $field ) {
|
public function validate_options( Field $field ) {
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Items extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'Title of the item', 'tainacan' ),
|
'description' => __( 'Title of the item', 'tainacan' ),
|
||||||
'on_error' => __( 'The title should be a text value and not empty', 'tainacan' ),
|
'on_error' => __( 'The title should be a text value and not empty', 'tainacan' ),
|
||||||
'validation' => v::stringType()->notEmpty(),
|
//'validation' => v::stringType()->notEmpty(),
|
||||||
],
|
],
|
||||||
'status' => [
|
'status' => [
|
||||||
'map' => 'post_status',
|
'map' => 'post_status',
|
||||||
|
|
Loading…
Reference in New Issue