Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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'),
Comment | File | Size | Author |
---|---|---|---|
#8 | module_status 2009.06.06.jpg | 120.58 KB | fabius |
#4 | filefield_widget_notices.patch | 1.71 KB | quicksketch |
filefield_widget_notice.patch | 922 bytes | pletcher |
Comments
Comment #1
dawehnerthis makes total sense for me, and patch works fine here.
isn't !empty($foo) the same as isset($foo) && $foo
Comment #2
quicksketchYep, I'll probably switch out the conditional with !empty(), otherwise looks good.
Comment #3
pletcher CreditAttribution: pletcher commentedFound another, now with new !empty().
Comment #4
quicksketch3 instances fixed with attached patch.
Comment #5
quicksketchExcuse me, 4 instances fixed. :-)
Comment #7
fabius CreditAttribution: fabius commentedI 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
Comment #8
fabius CreditAttribution: fabius commentedThe 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