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.
Hello,
I have noticed that when I leave a video field blank, the label and related DIVs are still shown while viewing the node.
Obviously this is problematic because I am trying to theme the video container and I don't want it displayed when there aren't any videos to show.
I did a few searches and couldn't find anything, if this has already been answered I apologize.
Thanks much
Comment | File | Size | Author |
---|---|---|---|
#8 | emthumb_empty_render.patch | 8.62 KB | OnkelTem |
Comments
Comment #1
llribas CreditAttribution: llribas commentedI'm in the same problem....
i find this http://drupal.org/node/259265 but don't work for me...
Comment #2
Kirk CreditAttribution: Kirk commentedI ended up just doing a work-around at node.tpl.php
Essentially, I did this. Not sure if there is a better way to get the same outcome, but so far it seems to work exactly as I wanted. Took me a while to figure out to use ['value'], since my PHP knowledge is pretty recreational.
Comment #3
OnlineWD™ CreditAttribution: OnlineWD™ commentedSubscribing.
Comment #4
porg CreditAttribution: porg commentedDear maintainer(s): This bug still exists in version 6.x-2.3. A response would be appreciated! Thanks!
How I realized it? I created a custom content type "Video" which has both a Video field and a 3rd Party Video field, so that it can use EITHER internal OR external video.
Possible video field scenarios and their effect on the HTML rendering are:
1) Internal undefined, external defined: External field rendered, internal field does not get rendered into HTML. Behavior as expected!
2) Internal defined, external undefined: Internal field rendered, unexpectedly the external field is rendered as well! Considering this as a bug! Why? Rendering an undefined (internal video) field makes no sense in terms of data structure and SEO, and in some cases it can also disturb the style/layout and therefore user experience/interface. In my case emfield's "orphaned" Lightbox play button is positioned so unhappily, that it overlays other elements of the page.
These are the modules, in the order of how I considered their responsibility:
1) CCK as it generally handles fields. From its issue tracker, I came to the conclusion, that it feels not really responsible to decide whether to render/omit empty fields, and rather leaves this decision to the processing later in the pipe (see: Empty field handling), to other modules which use fields, or even later, in the template.php logic (see: Do not output empty fields) .
2) FileField as it particularly allows file fields (such as the internal video files). According to Empty imagefield goes to HTML, this module correctly omits empty fields since 2009-03. From my experience with the Video field mentioned above, I can confirm that it correctly omits empty fields.
3) Embedded Media Field as it particularly provides the 3rd party media fields. A possible solution via template logic seems to be mentioned in Array exists even if no items added. Nevertheless a better handling by the module's logic would be desirable.
Comment #5
porg CreditAttribution: porg commentedComment #6
porg CreditAttribution: porg commentedMy intermediary solution: I keep the content type "Video" as is, so that it still has a Video field and a Emfield 3rd Party Video field, but defacto only use the Video field. At the Emfield I set the display fields for both teaser and node view to "exclude" and thereby enforce the omission. Into the help field I write "3rd party field shall currently not be defined until a technical problem is solved. If you want to publish video do so through the "Video" field".
As soon as Emfield's bug gets fixed, I will switch Emfield's display fields back on, and from then on I can create "Video" pages with either internal or external video content.
Comment #7
kobnim CreditAttribution: kobnim commentedIn general, multi-valued emvideo fields have been working fine for me.
But today I am seeing a similar problem: an empty multi-valued emvideo field displays the video icon.
I exported the content type ("old") and re-imported it under a new name ("new").
And the problem went away!
I then exported the "old" and "new" content types and compared them. Here are the differences:
OLD:
NEW:
OLD:
NEW:
OLD:
NEW:
Bottom line, you might try exporting and re-importing your content type.
Comment #8
OnkelTem CreditAttribution: OnkelTem commentedCreated a patch for the issue.
When field formatter is set to its basic type - showing a thumb, no problems occures. As we see from emthumb.theme.inc:
and from _emthumb_imagecache_formatter_default() :
theming stops if $options['item']['value'] has its value. Strange, but none of the other theming functions - for lightbox2, for full video replacement etc - has no any checks:
So I simply added checks everywhere like:
Comment #9
dale42Experiencing the problem of incomplete output being produced when the field is empty. Does not happen when display is set to default in node display. It does happen:
- When Content Type > Display Fields is set to an thumbnail w/Lightbox2
- In Views when output is set to thumbnail w/Lightbox2
Drupal 6.22, Embedded Media Field 6.x-2.5, Media: Vimeo 6.x-1.1, Lightbox2 6.x-1.11
Patch in #8 resolves the issue.
Comment #10
porg CreditAttribution: porg commentedAs #9 reports patch #8 as working: Could this please be merged into mainline?! Thanks.
Comment #11
inky@inky3d.com CreditAttribution: inky@inky3d.com commentedThe patch in #8 worked for me too.
Even though the video field was empty, its label and divs were appearing in the view.
The patch has sorted that out for me.
Comment #12
Michael-IDA CreditAttribution: Michael-IDA commentedBase cause is (probably) a PHP version change.
Just moved a site from one host to another, updated core from 6.22 to 6.26 (for error 500s from higher version of PHP), no modules updated, get this problem.
# drush pmi emfield
Extension : emfield
Project : emfield
Type : module
Title : Embedded Media Field
Version : 6.x-1.26
# php -v
PHP 5.2.17 (cli) (built: Oct 30 2012 16:03:14)
Just an FYI post,
Sam
Comment #13
Michael-IDA CreditAttribution: Michael-IDA commentedAgainst emfield 6.x-2.6
Works to not have video fields display on node when empty.
Someone want to commit this?
Best,
Sam
Comment #14
aaron CreditAttribution: aaron commentedComment #15
aaron CreditAttribution: aaron commentedIt doesn't apply to the current dev.