Reproduce:
Edit a node, the path being /node/{nid}/edit
An entry will be written as a notice in the logs:
Easy Breadcrumb could not determine the title to use for /node/{node}/edit
It's not appropriate to be doing this. Not sure if there are other (similar) paths that need to be excluded as well at this?
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | node_edit_title-3071782-13.patch | 1.86 KB | oriol_e9g |
| #4 | notice_on_edit_pages-3071782-4.patch | 1.39 KB | deaom |
Comments
Comment #2
martinma commentedFor me its a bug, because such misleading message in dblog are confusing people ...
In my dblog there are some dozens messages of this. It seems, all messages are in conjunction with edit path.
Comment #3
greg boggsWhen the getTitle method fails, Easy Breadcrumb logs the failure. The next step here is to either edit Easy Breadcrumb code so that it can get the title from that route, or to fix the core node edit form so that it sets a title callback. Patches, are of course, welcome!
~G
Comment #4
deaom commentedMy attempt at resolving this is in the attached patch. It seems it goes two times through the code of getting the title and the first time, title is null on the node/{node}/edit path, so the notice is displayed, but the second time, the title can be obtained, because the route changes to node/{node}. So added a check if the path is node/{node}/edit do not get the title, because it does not exist yet.
Comment #5
pgrandeg commentedAs I can see, #4 is right and there is a redirection, but the paths I found are: "/node/{node}" and "/node" instead of /node/{node}/edit.
So, should be the patch path changed from "/node/{node}/edit" to "/node"?
Comment #6
nace_fr commentedHi. I was able to reproduce the issue and tested patch from #4. It applied successfully and solved the issue.
Also I have checked the #5 comment and I don't think the patch should be changed. I checked and paths are /node/{node}/edit and /node/{node}, so patch from #4 solves the issue and doesn't need to be changed.
Changing status to RTBC.
Comment #7
greg boggsTo solve this Easy Breadcrumb should print the title. I don't know why node edit forms don't have title callbacks, but this is probably a core bug. We can either work around it by getting the title with some hacky code, or open an issue on node and get the title set on the form.
I see a page title when I load the page, so I'm sure the title is on the page somehow :)
Comment #8
greg boggsComment #9
oriol_e9gBetter issue title to improve issue discoverability. Same problem, I agree that not report the warning is a temporally fix that not solves the bug.
Comment #10
oriol_e9gExtra. The patch in #4 only works if you not use an alternative path and only fix nodes, not other entities. For example, if you alter the path to edit the node:
Will fail again:
The final solution should be fix in getTitleString or fix titleResolver in core that only looks for '_title_callback' or '_title' on the route. Core titleResolver return false in all routes without _title or _title_callback.
Comment #11
oriol_e9gOk. This is my patch to catch the title in node.edit instead of hide the warning, works in my site.
We can add this temporally fix for 'node.edit' and wait for a core solution in titleResolver, or try a more general solution to catch title in all entity forms if resolver not return a title. The second aproach is more general but it's harder and needs to inject form builder to retrive the title.
Comment #12
oriol_e9gInvestigating I have seen that pages can provide a title in $main_content['#title'] and this title can override the title provided by titleResolver. That's the reason why some pages like 'node.edit' not provide a title through routing+titleResolver and uses directly $main_content['#title'].
Ideally, to solve this problem we have to see first $main_content['#title'] and if it's empty use titleResolver to get the page title. Using the same logic used in Drupal\Core\Render\MainContent\HtmlRenderer::prepare
Comment #13
oriol_e9gI have done a patch to set a title for core routes that fail, all comes from:
_entity_form: "{$entity_type_id}.{$operation}".This is not the final solution, but it may be useful for someone.
Comment #14
oriol_e9gComment #15
greg boggsComment #17
greg boggsComment #18
kvantstudio commentedAfter uninstal custom content entity i have error. Path #13 not resolve the problem.
InvalidArgumentException: The controller for URI "" is not callable. in Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (line 75 of core\lib\Drupal\Core\Controller\ControllerResolver.php).Trace
Comment #19
oriol_e9gThis is a diferente bug, it's failing in title resolver call before the new code. This should be addresed in other issue.