function node_gallery_image_item_edit_form in Node Gallery 6.3
Same name and namespace in other branches
- 6 node_gallery.pages.inc \node_gallery_image_item_edit_form()
- 6.2 node_gallery.pages.inc \node_gallery_image_item_edit_form()
1 call to node_gallery_image_item_edit_form()
- node_gallery_manage_images_form in ./
node_gallery.pages.inc - Displays the content for our "Manage Images" tab, which is a VBO view.
File
- ./
node_gallery.pages.inc, line 515 - Handles displaying of Node gallery pages.
Code
function node_gallery_image_item_edit_form($form_values, $image, $relationship) {
module_load_include('inc', 'node', 'node.pages');
$form_state = array(
'values' => $form_values,
);
$display_fields = $relationship['settings']['manage_images_fields'];
$form = drupal_retrieve_form($image->type . '_node_form', $form_state, $image);
drupal_prepare_form($image->type . "_node_form", $form, $form_state);
$item_form = array();
$display_fields['#field_info'] = '#field_info';
//this should be merged with parent form to optionwidget to work
$display_fields['#node'] = '#node';
foreach (array_values($display_fields) as $field_name) {
if (!empty($field_name) && !empty($form[$field_name])) {
$item_form[$field_name] = $form[$field_name];
}
}
$item_form += (array) node_gallery_get_image_form_value_items($form);
node_gallery_set_image_form_default_values($item_form, $image, $relationship);
$item_form = node_gallery_flatten_image_item_edit_form($item_form);
foreach (element_children($item_form) as $key) {
$element =& $item_form[$key];
if (isset($element['#theme']) && $element['#theme'] == 'content_multiple_values') {
// we need to override several properties for multi-value fields
$nid = $item_form['#node']->nid;
$fieldname = $element['#field_name'];
$field_name_css = str_replace('_', '-', $fieldname);
$item_form[$key]['#prefix'] = '<div id="' . $field_name_css . '-items-' . $nid . '">';
$item_form[$key][$fieldname . '_add_more-' . $nid] = $item_form[$key][$fieldname . '_add_more'];
$item_form[$key][$fieldname . '_add_more-' . $nid]['#ahah']['wrapper'] = $field_name_css . '-items-' . $nid;
// change the path of the AHAH call
$item_form[$key][$fieldname . '_add_more-' . $nid]['#ahah']['path'] = 'node-gallery/json/js_add_more/' . $image->type . '/' . $fieldname;
$item_form[$key][$fieldname . '_add_more-' . $nid]['#name'] = $fieldname . '_add_more-' . $nid;
unset($item_form[$key][$fieldname . '_add_more']);
//$element['#field_name'] = $fieldname . '-' . $nid;
$item_form[$key]['#theme'] = 'node_gallery_content_multiple_values';
}
}
return $item_form;
}