0

I am using entity registration module for node registration.Now i wants to export the registrants.

I am using view export module to export registrants list. Its working fine

But as the registration fields is different per node i can not add a fix number of field to export.

I am trying to use global php field, its working for single column.

Is there any alternatives?

What other i have tried?

function paticipant_export_views_pre_view(&$view, &$display_id, &$args) {
          if ($view->name == 'paticipants_export') {
            views_db_object::add_item($view->current_display, 'field', 
    'field_data_field_first_name_1', 'field_first_name_1', 
$options = array(
            $handler->display->display_options['fields']['field_first_name_1']['id'] = 'field_first_name_1',
            $handler->display->display_options['fields']['field_first_name_1']['table'] = 'field_data_field_first_name_1',
            $handler->display->display_options['fields']['field_first_name_1']['field'] = 'field_first_name_1',

            ), $id = NULL);


          }
        }

Thanks for your suggestion.

10
  • programmatically build your view.
    – tenken
    Oct 27 '14 at 14:47
  • Can i achieve this altering the view or can i add fields dynamically to a view?
    – DRUPWAY
    Oct 27 '14 at 14:50
  • I doubt it as it would have to be in hook views pre build. Which is like really only 2 lines of php to make a new named view.
    – tenken
    Oct 27 '14 at 14:56
  • @tenken till now i have tried to use hook_views_pre_view(&$view, &$display_id, &$args) but not able to achieve my requirements.
    – DRUPWAY
    Oct 27 '14 at 15:04
  • Right you can't use hook_views_pre_view because the query has already run and the data retrieved by Views. This is why you could use hooks_views_pre_build to add fields before the query is built, a similar question (changing a view before it is run) can be seen here: drupal.stackexchange.com/questions/1561/… alternatively try this dropbucket.org/node/1178
    – tenken
    Oct 27 '14 at 18:20
0

This might be a really stupid suggestion but why dont you just edit the view and add all the registration fields manually. The view will have empty cells for fields thats not a part of the registration type at a specific row, but thats something you'll get anyways.

Another way to go is to skip views alltogether and export data with a module of your own using the entity api. You aparently are writing a module to override view fields above so you have already started down that road (so to speak)

0

Your Answer

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

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