Small patch to remove notices from the filefield widget.

Index: filefield_widget.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield_widget.inc,v
retrieving revision 1.86
diff -u -b -r1.86 filefield_widget.inc
--- filefield_widget.inc        20 Apr 2009 22:51:44 -0000      1.86
+++ filefield_widget.inc        21 Apr 2009 07:36:01 -0000
@@ -353,7 +353,7 @@
     '#access' => !empty($item['fid']),
   );
-  if ($field['description_field']) {
+  if (isset($field['description_field']) && $field['description_field']) {
     $element['data']['description'] = array(
       '#type' => 'textfield',
       '#title' => t('Description'),
@@ -363,7 +363,7 @@
     );
   }
-  if ($field['list_field']) {
+  if (isset($field['list_field']) && $field['list_field']) {
     $element['list'] = array(
       '#type' => empty($item['fid']) ? 'hidden' : 'checkbox',
       '#title' => t('List'),

Comments

Status:Active» Needs review

this makes total sense for me, and patch works fine here.

isn't !empty($foo) the same as isset($foo) && $foo

Yep, I'll probably switch out the conditional with !empty(), otherwise looks good.

Found another, now with new !empty().

Index: filefield_formatter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield_formatter.inc,v
retrieving revision 1.13
diff -b -r1.13 filefield_formatter.inc
95c95
<   if ($field['list_field']) {
---
>   if (!empty($field['list_field'])) {

Status:Needs review» Fixed
StatusFileSize
new1.71 KB

3 instances fixed with attached patch.

Excuse me, 4 instances fixed. :-)

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

I just upgraded a site to 6.12 and upgraded all the modules to latest versions. Images no longer display and I cannot edit the nodes. When I click EDIT the error message is:

Fatal error: Cannot unset string offsets in public_html/modules/filefield/filefield_widget.inc on line 441

There is no line 441 . . . . and I know only a little about php.

I am using CCK, Composite Layout, ImageCache and ImageField, etc

fabius

StatusFileSize
new120.58 KB

The problem reported above is fixed. I logged out and let it "settle" for a hour or so. When I logged back on, Drupal told me to update the database - then things worked fine (just one problem with i18n module, which won't recognise the update).

Faith restored.

Question if I have your attention:
The node edit page works fine for me but on this site the owner (a real estate agent) does all the content using the special page type I created. The various modules do not seem to be smoothly integrated for what should be a routine task. Is there a better approach?

jpg list of relevant modules attached.

fabius