function _handle_editablefield_form_input in Editable Fields 5
Same name and namespace in other branches
- 5.3 editablefields.module \_handle_editablefield_form_input()
- 5.2 editablefields.module \_handle_editablefield_form_input()
2 calls to _handle_editablefield_form_input()
- theme_views_editablefields_view_list in ./
editablefields.module - Display the nodes of a view as a list.
- theme_views_editablefields_view_table in ./
editablefields.module - Display the nodes of a view as a table.
File
- ./
editablefields.module, line 73
Code
function _handle_editablefield_form_input($view, $nodes) {
// it's really hard to check for each field, as we would have to decode the info
// data, I guess we could, but I dont see the harm, we will revent people from
// writing to nodes they are not allowed to below anyway.
$editable = false;
foreach ($view->field as $field) {
if ($field['options'] == 'editable') {
$editable = true;
}
}
if ($editable) {
$editable = FALSE;
foreach ($nodes as $node) {
if (node_access("update", $node)) {
$editable = TRUE;
}
}
}
if ($editable) {
foreach ($nodes as $node) {
if ($node = _editablefields_node_load_and_update($node->nid)) {
global $viewfield_stack;
$tmp = $viewfield_stack;
$viewfield_stack = array();
node_validate($node);
if (!form_get_errors()) {
$node = _editablefields_node_load_and_update($node->nid);
$node = node_submit($node);
// this will ensure that we do not touch ANY fields, appart from the
// ones we are aloud to touch
$node = _editablefields_node_load_and_update($node->nid, $node);
node_save($node);
}
$viewfield_stack = $tmp;
}
}
}
return $editable;
}