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.
PHP error notice displayed when tried to edit a language version of node.
Steps to reproduce this issue:
- Install fresh D8;
- Enable Content Translation module;
- Edit article content type;
- Enable translation under language settings;
- Edit article content type, click manage fields;
- Edit body;
- Enable translation for body field;
- In configuration, add languages;
- Create test article;
- Click translations tab;
- Add other language versions for the node;
- Click 'edit' to edit existing version of translations (Not the original copy);
The error notice will display as screenshot.
Line 135 in node module is trying to get node->type. This error displayed because the node didn't get loaded, as arg[1] is 'node' instead of nid.
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal-1937852-menu-get-active-help-4.patch | 516 bytes | mradcliffe |
#4 | drupal-1937852-menu-get-active-help-3.patch | 41.42 KB | mradcliffe |
Screenshot from 2013-03-09 12:52:34.png | 41.07 KB | rli |
Comments
Comment #0.0
rliGiving the steps to reproduce the issue.
Comment #1
rliComment #2
rliMove to language module as the langcode is added into menu in language module.
Comment #3
rliBeen frustrating about this. What's the point putting langcode in the menu e.g af /node/edit ? That is not doing anything unless we have translation_entity installed. And it made node_help confused.
Comment #4
mradcliffeDrupal\system\Plugin\Block\SystemHelpBlock->access() calls menu_get_active_help(), which sends in the incorrect arguments to hook_help for the node edit router path or the incorrect router path for the language arguments. node_help() loads the node entity ONLY to get the node type so that it can display the content type help (submission guidelines).
The query that is built contains a data type mismatch, which is not allowed in Postgresql.
Semi-related issues:
- #2056627: Form API autocomplete is broken for routes
- #244090: Tie help into menu router
Possible resolutions:
- Get rid of hook_help(), one of the last remaining hooks from Drupal 3. :*(
- Language, menu, or help should normalize arguments before passing in to hook_help implementation.
- Find a different way of getting the node type in node_help.
The easiest resolution is to pass the current path as the second parameter in arg(), which is what the one-line patch does.
Tests:
- A unit test that tests drupal_help_arg() output?
Comment #5
mradcliffeCrap. git diff origin/8.x from the wrong branch so it pulled in a bunch of other things that I committed from other postgres issues.
Comment #6
tim.plunkettNice find, needs tests
Comment #7
BerdirDuplicate of #1831846: Help block is broken with language path prefixes I think.
Comment #8
mradcliffeForgot to do this a while ago.
Comment #8.0
mradcliffefixing typo