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 get the following error when I enable Taxonomy Display:
Notice: Trying to get property of non-object in taxonomy_term_title() (line 1715 [...] public-html/modules/taxonomy/taxonomy.module)
This happens on the taxonomy term page and appears 3x each time it appears.
The error goes away when I disable Taxonomy Display.
This is a pretty vanilla site, new install, one taxonomy and one content type. Nothing special that I can tell at least. Let me know what additional info I can provide.
Comment | File | Size | Author |
---|---|---|---|
#4 | taxonomy_display-smart_title_callback-1906466-4.patch | 1.09 KB | siefca |
Comments
Comment #1
jay-dee-ess CreditAttribution: jay-dee-ess commentedActually, looks like it may be a conflict with the Disable Term Node Listings, which I had enabled, but was not using. Disabled that and the error went away.
Comment #2
siefca CreditAttribution: siefca commentedSame error here. I'm not using Disable Term Node Listings module, I just created taxonomy view based on built-in view and then removed it (wanted go back to built-in rendering). Then the error appeared.
Comment #3
siefca CreditAttribution: siefca commentedOh, that function gets some (term?) ID, not a term name, but asumes that it's a term object, that's why it happens.
The ID comes from some built-in or a view, that operates on ID-s instead of term objects. That's the problem. Let's see..
In my case the term ID is not just a term ID, it is a term ID from menu path that points to taxonomy term (my main menu links to terms from one of vocabularies).
The error comes from my patched version of
menu_block_split
module, which does menu item translation using Drupal's_menu_link_translate()
. That function causes itle callbacks to be fired.Some modules will affect Taxonomy Display in that way if they are using menu items translation and operate on (link to) taxonomy paths.
Taxonomy Display will then catch it with registered
title callback
hook.I will add a patch that filters out such cases.
Comment #4
siefca CreditAttribution: siefca commentedAttaching a patch that adds some additional checks to see if we're getting real taxonomy term object.
It tries to obtain one if the given argument is numeric (assumed: term ID) or a string (assumed: term name).
Comment #5
sierratelecom CreditAttribution: sierratelecom commentedI applied this patch and it resolved the problem. Thanks
Comment #6
ron_s CreditAttribution: ron_s commentedI can confirm this patch fixes the error displayed after enabling the Disable Term Node Listings module. Thanks for posting it!