You are here

function recommender_prepare_data_structure in Recommender API 7.6

Fill in the missing 'data structure' data from hook_recommender_data().

Parameters

$data_structure_override:

Return value

mixed

3 calls to recommender_prepare_data_structure()
CFRecommender::initialize in classes/Recommender.php
Initialize the recommender settings from $params. No complexity should be introduced here.
recommender_command_form_submit in ./recommender.module
recommender_views_data in ./recommender.views.inc
Implements hook_views_data().

File

./recommender.module, line 259

Code

function recommender_prepare_data_structure($data_structure_override) {
  $default_data_structure = array(
    'preference' => array(
      'name' => 'recommender_preference',
      'user field' => 'uid',
      'item field' => 'eid',
      'score field' => 'score',
      'score type' => 'number',
      // or could be 'boolean'
      'timestamp field' => 'updated',
    ),
    'user similarity' => array(
      'name' => 'recommender_user_similarity',
      'user1 field' => 'uid1',
      'user2 field' => 'uid2',
      'score field' => 'score',
      'timestamp field' => 'updated',
    ),
    'item similarity' => array(
      'name' => 'recommender_item_similarity',
      'item1 field' => 'eid1',
      'item2 field' => 'eid2',
      'score field' => 'score',
      'timestamp field' => 'updated',
    ),
    'prediction' => array(
      'name' => 'recommender_prediction',
      'user field' => 'uid',
      'item field' => 'eid',
      'score field' => 'score',
      'timestamp field' => 'updated',
    ),
    'item entity type' => 'node',
    'user entity type' => 'user',
  );

  // note: here we add all the 4 tables even though they are not defined in $data_structure_override.
  return drupal_array_merge_deep($default_data_structure, $data_structure_override);
}