Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I'm getting the message in the Title bar when I edit a node.
Any help? Please, CC
Comment | File | Size | Author |
---|---|---|---|
#39 | node_summary_token.zip | 1.29 KB | netbear |
#9 | 1178580-body-field-tokens.patch | 2.06 KB | Dave Reid |
#4 | 1178580-body-field-tokens.patch | 1.84 KB | Dave Reid |
Comments
Comment #1
CharlieCastle CreditAttribution: CharlieCastle commentedAnyone?
Comment #2
Dave ReidThis looks like it is a problem with Drupal core's token integration for the [node:body] and [node:summary] tokens for when a node type does not contain a body field.
Comment #3
Dave ReidComment #4
Dave ReidComment #6
Dave ReidMarked #1277472: Undefined index: de in node_tokens() as a duplicate of this issue.
Comment #7
Dave ReidComment #8
Dave ReidMarked #1278480: Notice: Undefined index in node_tokens() as a duplicate of this issue.
Comment #9
Dave ReidRevised patch that attempts to use the language code passed in via $options['language']->language when using field_get_items() and _text_sanitize().
Comment #10
jagmeister CreditAttribution: jagmeister commentedWill I be able to use this patch even though I am using drupal 7.8 and the patch details says 8.x for the branch core?
Comment #11
yeha CreditAttribution: yeha commentedThis works fine on my 7.8
Comment #12
jagmeister CreditAttribution: jagmeister commentedThanks yeha and Dave Reid for your help so far. However, for the life of me I am yet to find a topic that explains to a newbie on how to install a ptch on a webserver like hostmonster. everything i see is how to do it on a local computer. I installed dush thinking that would help only to find out that it didn't. I installed gitsmart and got nowhere either. I am stumped.
Comment #13
jagmeister CreditAttribution: jagmeister commentedwhen i tried to patch tokens.module i get the following:
patching file token.module
Hunk #1 FAILED at 155.
1 out of 1 hunk FAILED -- saving rejects to file token.module.rej
can't find file to patch at input line 24
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/modules/node/node.tokens.inc b/modules/node/node.tokens.inc
|index b6bafc6..491ec81 100644
|--- a/modules/node/node.tokens.inc
|+++ b/modules/node/node.tokens.inc
--------------------------
File to patch:
Comment #14
jagmeister CreditAttribution: jagmeister commentedWHOHOOOOOOOO! finally. patch successfull and bug is gone.
I finally found how to patch but was patching in the tokens folder instead of the node folder.
Thanks everyone. It goes to show that resilience goes a long way.
Comment #15
boryna CreditAttribution: boryna commented#9: 1178580-body-field-tokens.patch queued for re-testing.
Comment #16
RedJane CreditAttribution: RedJane commentedYes, it works also on 7.8... thank you for patching it!
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks for patching! Works fine on 7.8 for me! :-)
Comment #18
oriol_e9gBug confirmed, fix looks fine, patch tested, testbot happy, so...
Comment #19
catchOnly thing that looked a bit iffy here was _text_sanitize() but we're already using that - is there an issue somewhere to avoid having to call the private function?
Committed and pushed to 8.x. Moving to 7.x for webchick.
Comment #20
webchickCommitted and pushed to 7.x. Thanks!
Comment #21
dothraki CreditAttribution: dothraki commentedI got the same problem, but I don't understand how to apply the patch.
When I google "apply a patch to drupal 7" I get alot of results, but most tutorials are on Windows/Mac or with Git.
My site already runs online and I can only access it via DirectAdmin or FileZilla.
Handy links or suggestions are welcome!
Comment #22
dothraki CreditAttribution: dothraki commented#9: 1178580-body-field-tokens.patch queued for re-testing.
Comment #24
dothraki CreditAttribution: dothraki commentedOk, I found an article on "manuelly applying a patch" and it works.
Go to modules/node/node.tokens.inc
line 135-144:
case 'body':
case 'summary':
if (!empty($node->body)) {
$item = $node->body[$node->language][0];
$column = ($name == 'body') ? 'value' : 'summary';
$instance = field_info_instance('node', 'body', $node->type);
$replacements[$original] = $sanitize ? _text_sanitize($instance, $node->language, $item, $column) : $item[$column];
}
break;
change this with:
case 'body':
case 'summary':
if ($items = field_get_items('node', $node, 'body', $language_code)) {
$column = ($name == 'body') ? 'value' : 'summary';
$instance = field_info_instance('node', 'body', $node->type);
$field_langcode = field_language('node', $node, 'body', $language_code);
$replacements[$original] = $sanitize ? _text_sanitize($instance, $field_langcode, $items[0], $column) : $items[0][$column];
}
break;
Save upload and the body of my nodes shows up.
http://drupal.org/node/34422
This is the best article about patching !
greetz
Comment #25
catchComment #27
plachfield_get_items()
is better than$node->language
but will need to be fixed with anything coming out from #1260640: Improve field language API DX.As above.
-25 days to next Drupal core point release.
Comment #28
plachWe'll need tests to cover this bug, I guess.
Comment #29
Dave ReidNot sure how #27 is an actual reason to re-open a closed issue...
Comment #30
Dave ReidPlease file a separate issue.
Comment #31
plachThe reason is simply that this cannot be considered fixed, since sites exploiting translatable fields might now get the wrong token values under certain conditions.
Comment #32
Dave ReidShouldn't field_language gracefully fallback since it's used by field_get_items()? If this is a failure in the field API then it should be fixed there.
Comment #33
plachAs pointed out in #1260640: Improve field language API DX,
field_get_items()
returns the field values in the current content language (or fallback values), which may lead to an inconsistent behavior if the current language differs from the node language. Say I save the same node first with current language 'en' and then with current language 'it' and body values are available for both languages: token values will be english and italian respectively, which may be a problem if the resulting value is going to be stored.Comment #34
storytellerjeff CreditAttribution: storytellerjeff commentedI wanted to give this a bump as I'm still experiencing a related error message, using core 7.19.
Notice: Undefined index: summary in node_tokens() (line 142 of .../modules/node/node.tokens.inc).
I see that the patches in #24 and #27 made it into core, but if you have a node summary but no "body" field, then this warning still pops up often. It doesn't seem to have an effect (i.e. not a harmful bug) as mentioned above, but it would be great not to have a page full of warnings in my watchdog.
Any suggestions?
Comment #35
netbear CreditAttribution: netbear commentedI confirm, also have this problem in drupal 7.19
Notice: Undefined index: summary in node_tokens() (line 142 of .../modules/node/node.tokens.inc).
Comment #36
netbear CreditAttribution: netbear commentedI flushed token cache with call to function token_clear_cache(); and notices are gone for now.
Comment #37
netbear CreditAttribution: netbear commentedNo, the problem is back now, flushing token cache didn't help.
Comment #38
Anonymous (not verified) CreditAttribution: Anonymous commentedI too am having this issue, does anyone know a work around? I don't want to disable messages but that's the only thing I can think of! Any help would be appreciated.
Comment #39
netbear CreditAttribution: netbear commentedI found a little module for quick solving of the problem http://drupal.org/project/node_summary_token
Also found another snippet in this comment http://drupal.org/node/1295524#comment-5825254
and created module from it, attached it to my comment.