1

I want to join my custom table with node fields. In my custom table there is a nid field for which I have used join and another is uid field for which I want a condition where uid = current_user_uid. But adding this in custom handler it giving me duplicate record if I have three [nid, uid] pair.

For ex : I have [1, 1] and [1, 2] and [2, 1] pair then it should be give me first and third record if I am logged in using first user and second pair if I am logged in using 2nd user. But it is giving me all the records.

My Code sample :

  $data = array();

  // Create a new group by which the of this module plugins would be grouped.
  $data['custom_table']['table']['group'] = t('Event');

  // Join the table with default node table.
  $data['custom_table']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );  

  $data['custom_table']['id'] = array(
    'title' => t('Unique Id'),
    'help' => t('Unique Id id.'),
    'field' => array(
      'handler' => 'views_handler_custom_field_id',
    ),
  );

  return $data;

Edit :

I didn't found any way to do this in my custom module. Somehow I managed to do it with view's template file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.