function _editablefields_node_load_and_update in Editable Fields 5
Same name and namespace in other branches
- 5.3 editablefields.module \_editablefields_node_load_and_update()
- 5.2 editablefields.module \_editablefields_node_load_and_update()
handle editable field forms, and return back if there are editable fields
1 call to _editablefields_node_load_and_update()
File
- ./
editablefields.module, line 49
Code
function _editablefields_node_load_and_update($nid, $oldnode = NULL) {
$node = node_load($nid);
if (node_access("update", $node)) {
$nodeupdate = FALSE;
if ($_POST['op']) {
foreach ($_POST as $post => $value) {
if (sscanf($post, "editablefield_%d_%s", $nid, $fieldname) == 2) {
if ($nid == $node->nid) {
if ($node->{$fieldname} != $value) {
$node->{$fieldname} = $oldnode ? $oldnode->{$fieldname} : $value;
$nodeupdate = TRUE;
}
}
}
}
}
}
return $nodeupdate ? $node : NULL;
}