creating prop semantic_uri to store metadatum schema information

This commit is contained in:
Jacson Passold 2018-07-26 10:58:35 -03:00
parent 3af2026327
commit c7889eeaa0
3 changed files with 33 additions and 3 deletions

View File

@ -211,6 +211,15 @@ class Metadatum extends Entity {
return $this->get_mapped_property('exposer_mapping'); return $this->get_mapped_property('exposer_mapping');
} }
/**
* Return the semantic_uri
*
* @return string
*/
function get_semantic_uri(){
return $this->get_mapped_property('semantic_uri');
}
/** /**
* Set the metadatum name * Set the metadatum name
* *
@ -362,6 +371,15 @@ class Metadatum extends Entity {
$this->set_mapped_property('exposer_mapping', $value); $this->set_mapped_property('exposer_mapping', $value);
} }
/**
* Set Semantic URI for the metadatum
*
* @param [string] $value
* @return void
*/
function set_semantic_uri( $value ){
$this->set_mapped_property('semantic_uri', $value);
}
/** /**
* Transient property used to store the status of the metadatum for a particular collection * Transient property used to store the status of the metadatum for a particular collection

View File

@ -40,6 +40,10 @@ class Metadata extends Repository {
} }
/**
* {@inheritDoc}
* @see \Tainacan\Repositories\Repository::get_map()
*/
public function get_map() { public function get_map() {
return apply_filters('tainacan-get-map-'.$this->get_name(), [ return apply_filters('tainacan-get-map-'.$this->get_name(), [
'name' => [ 'name' => [
@ -182,6 +186,14 @@ class Metadata extends Repository {
'validation' => v::stringType()->in( [ 'yes', 'no', 'never' ] ), 'validation' => v::stringType()->in( [ 'yes', 'no', 'never' ] ),
'description' => __( 'Display by default on listing or do not display or never display.', 'tainacan' ), 'description' => __( 'Display by default on listing or do not display or never display.', 'tainacan' ),
'default' => 'yes' 'default' => 'yes'
],
'semantic_uri' => [
'map' => 'meta',
'title' => __( 'The semantic metadatum description URI' ),
'type' => __( 'url' ),
'validation' => v::optional(v::url()),
'description' => __( 'The semantic metadatum description URI like: ', 'tainacan' ).'https://schema.org/URL',
'default' => ''
] ]
] ); ] );
} }

View File

@ -403,7 +403,7 @@ class Exposers {
$metadatum->set_metadata_type('Tainacan\Metadata_Types\Text'); $metadatum->set_metadata_type('Tainacan\Metadata_Types\Text');
} }
$metadatum->set_name($mapper_metadatum['label']); $metadatum->set_name($mapper_metadatum['label']);
$metadatum->set_description($mapper_metadatum['URI']); $metadatum->set_semantic_uri($mapper_metadatum['URI']);
$metadatum->set_exposer_mapping([ $metadatum->set_exposer_mapping([
$mapper->slug => $slug $mapper->slug => $slug
]); ]);