so I've been trying to implement a 'sample request' feature on my site. I had tried to use the webform views module, which worked except that I couldn't add checkboxes to the view that displayed and webform views doesn't play well with the latest release of webform.
I found this Sample Request w Views, Flag, and Webform tutorial, which is basically exactly my use case.
I've created my own module, and am stuck with some of syntax in the view and options parsing array function. The article mentions that I need to reference the title of the nodes 'owner' but I'm not 100% on how this applies to my implementation.
I've altered the code so the function names reflect my custom module, my predefined view of my flag, but I can't get the list to show up in my predefined lists options. I think this is because I don't have the right field referencing my node's title, but I'm not sure. Also the dpm() statement didn't fire.
I know this is a lot, thanks in advance.
function webform_hook_select_options_info() { $items = array(); if (function_exists('_MODULE_user_flag_sample_requests')) {
$items['MODULE_user_flag_sample_requests'] = array(
'title' => t("Sample Requests (User Flag list)"),
'options callback' => '_MODULE_user_flag_sample_requests',
);}return $items;} function _MODULE_user_flag_sample_requests() {$view = views_get_view('webform_flag_views', TRUE);$view->set_display('webform_options');$view->execute();$options = array();dpm($options);if ($view->result) {$row_class = $view->style_options['row_class'];$attributes = $row_class ? " class='$row_class'" : '';
foreach($view->result as $item) {
$options[$item->nid] = '<a' . $attributes . '>' . render($item->field_field_img[0]['rendered']) . ' ' . $item->field_ref_node_title . ' (' . $item->node_title . ')' . '</a>';
}}else {
$options[0] = t("Nothing");}return $options;}