0

I'm trying to show the purl.value value on a view's page.

It seems to be grabbing all of the data, however it isn't showing in the final results. Here's my code:

function mymodule_views_query_alter(&$view, &$query) {
  //watchdog("view information", print_r($view, true));
  if ($view->name == 'project_management') {



    $join = new views_join;
  $join->table ='purl';
  $join->left_table = 'node';
  $join->left_field = 'nid';
  $join->field = 'id';
  $join->type = "LEFT";
  $join->extra_type = 'AND';
  $join->adjusted = 'TRUE';


    $view->query->table_queue['purl'] = array(
    'table' => 'purl',
    'num' => 1,
    'alias' => 'purl',
    'join' => $join,
    'relationship' => 'node',
  );

    $view->query->tables['purl'] = array(
    'count' => 1,
    'alias' => 'purl'
  );

$view->query->add_field('purl', 'value');
  }
}

What exactly am I missing? Do I need a view handler? I was told that maybe using hook_views_data_alter() might be better for my purposes.

How do I add a visible custom piece of data from that column on my view page?

1 Answer 1

1

you should map your data to views, so it will be available from views admin UI

check This tutorial where you will find the basics for describe custom data and tables to views.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.