Commit c02fd5eb authored by drewish's avatar drewish

Clean up some PHP warnings.

parent 9ff38ea7
......@@ -89,7 +89,7 @@ function field_file_save_upload($source, $validators = array(), $dest = FALSE, $
if (!@chmod($file->filepath, 0664)) {
watchdog('filefield', 'Could not set permissons on destination file: %file', array('%file' => $file->filepath));
}
// Let modules add additional properties to the yet barebone file object.
foreach (module_implements('file_insert') as $module) {
$function = $module .'_file_insert';
......@@ -292,7 +292,7 @@ function _field_file_cache($file = NULL, $reset = FALSE) {
// Cache the file by both fid and filepath.
// Use non-copying objects to save memory.
if (isset($file)) {
if (!empty($file->fid)) {
$files[$file->fid] = $file;
$files[$file->filepath] = $file;
}
......
......@@ -285,18 +285,22 @@ function filefield_widget(&$form, &$form_state, $field, $items, $delta = 0) {
if (empty($form['#submit']) || !in_array('filefield_node_form_submit', $form['#submit'])) {
$form['#submit'][] = 'filefield_node_form_submit';
}
$form['#attributes'] = array('enctype' => 'multipart/form-data');
module_load_include('inc', 'filefield', 'field_widget');
module_load_include('inc', $field['widget']['module'], $field['widget']['module'] .'_widget');
$form['#attributes'] = array('enctype' => 'multipart/form-data');
$item = array('fid' => 0, 'list' => $field['list_default'], 'data' => array('description' => ''));
if (isset($items[$delta])) {
$item = array_merge($item, $items[$delta]);
}
$element = array(
'#title' => $field['widget']['label'],
'#type' => $field['widget']['type'],
'#default_value' => array_merge(array('fid' => 0, 'list' => $field['list_default'], 'data' => array('description' => '')), $items[$delta]),
'#default_value' => $item,
'#upload_validators' => filefield_widget_upload_validators($field),
);
module_load_include('inc', $field['widget']['module'], $field['widget']['module'] .'_widget');
return $element;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment