function _handle_editablefield_form_input in Editable Fields 5.3
Same name and namespace in other branches
- 5 editablefields.module \_handle_editablefield_form_input()
- 5.2 editablefields.module \_handle_editablefield_form_input()
4 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_list_noform 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.
- theme_views_editablefields_view_table_noform in ./
editablefields.module - Display the nodes of a view as a table.
File
- ./
editablefields.module, line 87
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) { // we dont need to be THIS zealous
$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, array(
'title' => array(
'#parents' => array(
'title',
),
),
));
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);
//This implements auto_nodetitle actualization
if (variable_get('ant_' . $node->type, 0)) {
auto_nodetitle_set_title($node);
}
node_save($node);
}
$viewfield_stack = $tmp;
}
}
}
return $editable;
}