I'd like to customize the webform everytime the user saves a webform node. I'm using rules with a custom action that updates the webform when the user saves the node. Looking at devel, I haven't been able to figure out what the proper key to specify a parent fieldset is.
In my action I have the following:
for ($j = 1; $j <= 5; $j++) {
$node->webform['components'][$i] = array(
'nid' => $node->nid,
'cid' => $i,
'pid' => 0,
'form_key' => "participant$j",
'name' => "Participant",
'type' => 'fieldset',
'value' => '',
'weight' => $j,
'display' => array(
'addmore' => $i,
),
'extra' => array(
'description' => 'Please provide the participant information listed below. Required items are denoted with an asterisk.',
'title_display' => 0,
'private' => 0,
'collapsible' => 1,
'conditional_component' => '',
'conditional_operator' => '=',
'conditional_values' => '',
'mandatory' => 0,
'page_num' => 1,
),
);
$i++;
$node->webform['components'][$i] = array(
'nid' => $node->nid,
'cid' => $i,
'pid' => 0,
'form_key' => "first_name$j",
'name' => 'First Name',
'type' => 'textfield',
'value' => '',
'parent' => "participant$j",
'extra' => array(
'display' => array(
'addmore' => $i,
),
'title_display' => 'inline',
'private' => 0,
'disabled' => 0,
'unique' => 0,
'maxlength' => 60,
'width' => '',
'field_prefix' => '',
'field_suffix' => '',
'description' => '',
'attributes' => array(),
'conditional_component' => '',
'conditional_operator' => '=',
'conditional_values' => '',
'mandatory' => 1,
'page_num' => 1,
),
);
$i++;
...