ontologie pondération
hook_entity_property_info_alter Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
493d3bf780
commit
e218aeb4da
@ -90,6 +90,55 @@ function materio_search_api_menu() {
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* hook_entity_property_info_alter().
|
||||
*/
|
||||
function materio_search_api_entity_property_info_alter(&$info){
|
||||
// dsm($info, 'hook_entity_property_info_alter | info');
|
||||
$properties = &$info['node']['properties'];
|
||||
for ($i=1; $i <= 5 ; $i++) {
|
||||
$properties['materio_search_api_taxonomy_term_'.$i] = array(
|
||||
'type'=>'taxonomy_term',
|
||||
'label'=> t('Main taxonomy term '.$i),
|
||||
'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_main_taxonomy_term_'.$i,
|
||||
);
|
||||
}
|
||||
|
||||
return $properties;
|
||||
}
|
||||
|
||||
function materio_search_api_get_main_taxonomy_term_1($item){
|
||||
// dsm($item, 'item');
|
||||
return materio_search_api_get_onto_term($item, 0);
|
||||
}
|
||||
function materio_search_api_get_main_taxonomy_term_2($item){
|
||||
// dsm($item, 'item');
|
||||
return materio_search_api_get_onto_term($item, 1);
|
||||
}
|
||||
function materio_search_api_get_main_taxonomy_term_3($item){
|
||||
// dsm($item, 'item');
|
||||
return materio_search_api_get_onto_term($item, 2);
|
||||
}
|
||||
function materio_search_api_get_main_taxonomy_term_4($item){
|
||||
// dsm($item, 'item');
|
||||
return materio_search_api_get_onto_term($item, 3);
|
||||
}
|
||||
function materio_search_api_get_main_taxonomy_term_5($item){
|
||||
// dsm($item, 'item');
|
||||
return materio_search_api_get_onto_term($item, 4);
|
||||
}
|
||||
|
||||
function materio_search_api_get_onto_term($item, $delta){
|
||||
// dsm($item, 'item');
|
||||
// dsm($delta, 'delta');
|
||||
|
||||
if(isset($item->field_onthologie['und'][$delta]))
|
||||
return taxonomy_term_load($item->field_onthologie['und'][$delta]['tid']);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_block_info().
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user