I have a view of persons. I like to add the persons to an event. I also like to set the status of the resulting relation to one of the values "optional" or "required".
Therefore I use VBO on a list of persons. With the submitted NIDs I like to build a relation from the person to the event and fill the relation data field "status" with the selected value from the from.
To create only the relation it was easy to create a new action with custom php code, which builds my relations programmatically.
To add a parameter to the relation I have to edit the view's form programmatically. So I hook into the form alter of the views form and add a custom dropdown with the two values "optional" or "required".
The questions are:
- Is it possible to use the selected dropdown value in the vbo action with custom php code? I only know how to handle the selected nid's. This option would be easier for me to implement.
- If 1) is not possible: Should I use a custom submit function for the vbo form? And where to assign the function?
I tried the following code to assign a custom submit custom_webform_pre_build_list_vbo_submit
function but it isn't called.
function custom_webform_pre_build_list_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == "views_form_person_list_panel_pane_9"
and $form['#id']=='views-form-person-list-panel-pane-9') {
$form['#submit'] = array('custom_webform_pre_build_list_vbo_submit');
}
}