function bulk_photo_nodes_create_overrides in Bulk File Nodes 7
Generate batch override form for bulk_photo_nodes_add_form().
This attaches a form that allows a user to fill out a given field one time and have it apply to all bulk_photo_nodes.
1 call to bulk_photo_nodes_create_overrides()
- bulk_photo_nodes_add_form in ./
bulk_photo_nodes.module - Form constructor for final step of bpn_multistep_form().
File
- ./
bulk_photo_nodes.module, line 327 - hooks and helper functions for bulk photo node.
Code
function bulk_photo_nodes_create_overrides(&$form, &$form_state) {
$node = bulk_photo_nodes_create_node($form_state['node_type']);
$form['override_fields'] = array(
'#type' => 'container',
'#tree' => TRUE,
'#attributes' => array(
'class' => array(
'bpn-right clearfix',
),
),
);
$form['override_fields']['fields'] = array(
'#parents' => array(
'override_fields',
'fields',
),
);
$form['override_fields']['fields']['title_display'] = array(
'#markup' => '<h2>Batch Settings</h2><p>(applies to all photos, unless overridden)</p>',
'#weight' => -11,
);
field_attach_form('node', $node, $form['override_fields']['fields'], $form_state);
$form['override_fields']['fields']['title'] = array(
'#type' => 'textfield',
'#title' => 'Title',
'#required' => FALSE,
'#weight' => -10,
);
$image_field = bulk_photo_nodes_get_image_field($node->type);
unset($form['override_fields']['fields'][$image_field]);
$form['override_fields']['finish'] = array(
'#type' => 'submit',
'#value' => t('Complete Upload'),
'#submit' => array(
'bulk_photo_nodes_add_form_submit',
),
);
// Set all batch fields as optional.
bulk_photo_nodes_recursive_set_optional($form['override_fields']['fields']);
// Attach AJAX handlers to all batch override form inputs.
bulk_photo_nodes_recursive_ajax($form['override_fields']['fields']);
}