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.
I have this set up with feeds and when importing fields I get the following errors.
Notice: Undefined property: stdClass::$nid in feeds_tokens() (line 32 of /sites/all/modules/feeds/feeds.tokens.inc).
Notice: Undefined index: title in imagefield_tokens_field_attach_presave() (line 203 of /sites/all/modules/imagefield_tokens/imagefield_tokens.module).
The alt field in enabled along with "Update every edit" and "Hide field" while using the node title token as the default value.
Comment | File | Size | Author |
---|---|---|---|
#7 | imagefield_tokens-title_alt_undefined-1889772-7.patch | 2.31 KB | mibfire |
Comments
Comment #1
13rac1 CreditAttribution: 13rac1 commentedThe first notice comes from Feed Tokens. Have you installed this patch or the current dev? #1817992: Notice: Undefined property: stdClass::$nid in feeds_tokens() (line 32 of feeds/feeds.tokens.inc)
Once Feeds Tokens doesn't have a problem, do you still get the notice from ImageField Tokens? We could add an additional test in their for the existence of 'title'.
Setting to Minor for PHP Notice.
Comment #2
walker2238 CreditAttribution: walker2238 commentedHey thanks for the quick response and helpful information.
I applied the patch and the issue still remains for imagefield tokens. Same error as before.
Notice: Undefined index: title in imagefield_tokens_field_attach_presave() (line 203 of /sites/all/modules/imagefield_tokens/imagefield_tokens.module).
Comment #3
walker2238 CreditAttribution: walker2238 commentedI should also mention that the alt tag remains blank when using a default image, but I guess that could be a separate issue.
Comment #4
walker2238 CreditAttribution: walker2238 commentedComment #5
ressa CreditAttribution: ressa commentedI am getting lots of these in my log files as well, but it all seems to be working fine nevertheless:
Comment #6
hwasem CreditAttribution: hwasem commentedI agree with ressa. I just installed this module to populate the alt field on my feeds imported images. I am replacing the alt field with the [node:title]. This seems like such a simple thing to accomplish, but I've had much trouble doing it. I am so hopeful I can get this module to help.
I have Feeds 7.x-2.0-alpha8 (4/26/13). Just to be sure, I confirmed the code form the patch listed in #1 above is included. The entire error is
I'm using ImageField Tokens 7.x-1.x-dev (2013-Sep-30).
The alt field appears to be populating correctly (Alt="Cover image for [node:title]"), but there is an error for every node I'm importing with Feeds. I'm not using the image's title attribute and don't have that enabled in my field attributes, so I found it odd "title" was the undefined index. I changed the token to be something other than title, but that did not change the error I received. So I don't know why is undefined.
UPDATE:
For testing, I enabled the image's title field and set its default value to [node:title]. Boom, error goes away and module works as configured.
I don't have a problem with having the title of the image be the node title, so this solution works for me, I guess. Hope it helps someone else.
Thanks,
Heidi
Comment #7
mibfire CreditAttribution: mibfire commentedFixed
Comment #8
millionleaves CreditAttribution: millionleaves as a volunteer commentedI encountered a version of this issue when I embedded an image in a field collection using the Media Browser. The patch in #7 stopped the error occurring - thanks.
However, I have the ALT text set to populate automatically using tokens. This bit isn't working - seems the tokens I've inserted into the default ALT text field aren't being rendered.
More specifically, I have two tokens like this:
[node-title] - [node:field-collection-field]
When I view the alt text on an image it is set to:
" - "
In other words, the spaces and dash between the tokens are being rendered, but not the token values themselves. I don't know whether the problem lies with the Imagefield Token module or the Media Browser, but the fact that part of my default ALT text value is being rendered suggests it is probably the former.
I tried a different default ALT Text value to use just node fields rather than a field from within the field collection, but the outcome was the same.
Comment #9
nickonom CreditAttribution: nickonom commented#7 worked for me, thanks and rtbc!
Comment #10
generalconsensus CreditAttribution: generalconsensus at Forum One commentedPlease patch 7.x, #7 works as suggested
Comment #11
interdruper CreditAttribution: interdruper commented#7 tested, rtbc.
Comment #12
AnybodyThank you very much, also confirming RTBC. Is there any active maintainer? The notices are appearing in all our projects an fill up watchdog. It would be very helpful to have a new module release containing the fix.
Comment #13
millionleaves CreditAttribution: millionleaves as a volunteer and commentedI've just encountered another issue with this module whereby ALT or TITLE tags that are set to use tokens will not correctly interpret characters such as apostrophes. The patch at this location fixes *that* issue but will not apply if you've applied the patch from #7 in *this* issue.
https://www.drupal.org/node/926966#comment-7564797
The patch to fix special characters in tokens is only a couple of new lines, so if you're going to apply both, you're probably better off applying the patch in #7 from here first and then manually adding the two new lines from the other patch.
I guess a new patch that merges the two would probably make sense (plus updating the other issue to be a duplicate of this one). Happy to post such a patch if required.
(EDIT: updated with link to the patch in the other issue)
Comment #14
NWOM CreditAttribution: NWOM commented#7 works great. Thank you!
Comment #15
ysamoylenko CreditAttribution: ysamoylenko at EPAM Systems commentedComment #17
ysamoylenko CreditAttribution: ysamoylenko at EPAM Systems commentedThe patch was committed.
Comment #18
ram4nd CreditAttribution: ram4nd as a volunteer commented