function editablefields_inline_form_submit in Editable Fields 6.3
Submit handler for fields.
1 string reference to 'editablefields_inline_form_submit'
- editablefields_inline_form in plugins/
responders/ inline.inc - Form API form function for field_edit_form. Returns a form api definition for editing fields.
File
- plugins/
responders/ inline.inc, line 132 - Editablefields CTools modal plugin.
Code
function editablefields_inline_form_submit($form, &$form_state) {
$nids = explode(',', trim($form_state['values']['nids'], ','));
$nids = array_unique($nids);
$replacements = array();
$field = $form['#field_info'][$form_state['_params']['field_name']];
foreach ($nids as $nid) {
if ($node = node_load($nid, NULL, TRUE)) {
$old_values = $node->{$field['field_name']};
$new_values = $form_state['values'][$field['field_name']];
$node->{$field['field_name']} = $new_values;
$node = node_submit($node);
node_save($node);
// TODO: persist the original text formatter from original view
$content_set_empty = content_set_empty($field, $new_values);
$replacements[$nid] = '';
foreach ((array) $node->{$field['field_name']} as $delta => $item) {
$item['delta'] = $delta;
$replacements[$nid] .= editablefields_inline_link_text($field, $item, $field['display_settings']['modal']['format'], $node);
}
}
}
$form_state += array(
'replacements' => $replacements,
);
}