Removes 'render' functions of the metadata type classes, as it is not used anymore.

This commit is contained in:
Mateus Machado Luna 2020-02-21 13:34:22 -03:00
parent 4957cf828f
commit 8264d35300
11 changed files with 0 additions and 138 deletions

View File

@ -19,20 +19,6 @@ class Compound extends Metadata_Type {
$this->set_component('tainacan-compound');
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-text
id="tainacan-text-' . $itemMetadata->get_item()->WP_Post->post_name . '"
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-text>';
}
/**
* generate the metadata for this metadatum type
*/

View File

@ -23,20 +23,6 @@ class Core_Description extends Metadata_Type {
$this->set_description( __('The "Core Description" is a compulsory metadata automatically created for all collections by default. This is the main description displayed in items lists and where the basic research tools will do their searches.', 'tainacan') );
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-textarea
id="tainacan-textarea-' . $itemMetadata->get_item()->WP_Post->post_name . '"
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-textarea>';
}
/**
* generate the metadata for this metadatum type
*/

View File

@ -23,20 +23,6 @@ class Core_Title extends Metadata_Type {
$this->set_description( __('The "Core Title" is a compulsory metadata automatically created for all collections by default. It is the main metadatum of the item and where the basic research tools will do their searches.', 'tainacan') );
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-text
id="tainacan-text-' . $itemMetadata->get_item()->WP_Post->post_name . '"
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-text>';
}
/**
* generate the metadata for this metadatum type
*/

View File

@ -27,19 +27,6 @@ class Date extends Metadata_Type {
');
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-date metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-date>';
}
public function validate( Item_Metadata_Entity $item_metadata) {
$value = $item_metadata->get_value();
$format = 'Y-m-d';

View File

@ -89,8 +89,6 @@ abstract class Metadata_Type {
* @var string
*/
private $preview_template;
abstract function render( $itemMetadata );
public function __construct(){

View File

@ -37,17 +37,4 @@ class Numeric extends Metadata_Type {
]
];
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-numeric
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-numeric>';
}
}

View File

@ -65,20 +65,6 @@ class Relationship extends Metadata_Type {
]
];
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-relationship
collection_id="' . $this->get_options()['collection_id'] . '"
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-relationship>';
}
public function validate_options(\Tainacan\Entities\Metadatum $metadatum) {
if ( !in_array($metadatum->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )

View File

@ -41,20 +41,6 @@ class Selectbox extends Metadata_Type {
]
];
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
$options = $this->get_option('options');
return '<tainacan-selectbox
options="' . $options . '"
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-selectbox>';
}
/**
* @param \Tainacan\Entities\Metadatum $metadatum

View File

@ -93,21 +93,6 @@ class Taxonomy extends Metadata_Type {
];
}
/**
* @param $itemMetadata Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
$options = ( isset( $this->get_options()['options'] ) ) ? $this->get_options()['options'] : '';
return '<tainacan-selectbox
options="' . $options . '"
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-selectbox>';
}
public function validate_options( Metadatum $metadatum) {
if ( !in_array($metadatum->get_status(), apply_filters('tainacan-status-require-validation', ['publish','future','private'])) )

View File

@ -25,18 +25,6 @@ class Text extends Metadata_Type {
</div>
');
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ){
return '<tainacan-text metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-text>';
}
/**
* Get the value as a HTML string with links

View File

@ -26,19 +26,6 @@ class Textarea extends Metadata_Type {
');
}
/**
* @param $itemMetadata \Tainacan\Entities\Item_Metadata_Entity The instace of the entity itemMetadata
* @return string
*/
public function render( $itemMetadata ) {
return '<tainacan-textarea
metadatum_id ="'.$itemMetadata->get_metadatum()->get_id().'"
item_id="'.$itemMetadata->get_item()->get_id().'"
value=\''.json_encode( $itemMetadata->get_value() ).'\'
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-textarea>';
}
public function get_multivalue_prefix() {
return '<p>';