Timeline for Check if current page is taxonomy term
Current License: CC BY-SA 3.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 9, 2013 at 14:34 | comment | added | Manu | @Clive, just experimented few days ago, and had to fall back to the arg() way... See merlinofchaos comment about this behavior. (It was on D6, but still valid on D7). More precisely does not replace the term loader but alters routing system. | |
Sep 6, 2013 at 10:20 | comment | added | Clive♦ | @Manu Are you sure? I mean I'll take your word for it as I don't have time to check, but it feels like I would've run into that before at some point and it doesn't ring a bell. If true that's definitely a bug in the views module IMO | |
Sep 6, 2013 at 10:18 | comment | added | Manu | @Clive Yep, but sadly does replace the term loader ever if you don't use the Views taxonomy term page replacement.. | |
Sep 6, 2013 at 9:12 | comment | added | Clive♦ | @Manu Good find. I would expect that behaviour though; after all, if you enable the replacement for the core taxonomy page it stands to reason that the load function would also be changed | |
Sep 6, 2013 at 9:08 | comment | added | Manu | Caution: Enabling Views replaces the taxonomy term loader, causing menu_get_object('taxonomy_term', 2); to not work anymore. See: drupal.org/node/1468006 and api.drupal.org/comment/45018#comment-45018 | |
Oct 31, 2012 at 21:28 | comment | added | Madis | Might be obvious for many, but for everyone else I'd like to point out that minor readability concerns should not be a reason to sacrifice the quality of your functionality. If using arg() is important for you and there's nothing better at hand then avoiding it would be wrong. The function exists since at least Drupal 5 and seems to be moving into version 8 for good reasons. | |
Oct 31, 2012 at 18:14 | vote | accept | Daniel Sachs | ||
Oct 31, 2012 at 16:42 | comment | added | Clive♦ |
@Chapabu Just thought actually, path_is_admin() would fail for the taxonomy/term/x/feed URLs so I think there might be a better method out there
|
|
Oct 31, 2012 at 16:41 | comment | added | Clive♦ | @Chapabu You should trademark that ;) | |
Oct 31, 2012 at 16:40 | history | edited | Clive♦ | CC BY-SA 3.0 |
deleted 22 characters in body
|
Oct 31, 2012 at 16:40 | comment | added | Chapabu | This answer has now the Chapabu seal of approval :) | |
Oct 31, 2012 at 16:39 | comment | added | Clive♦ |
@Chapabu Hah, didn't think to check the docs page :P Yeah the path_is_admin() method should do the trick, good call. I just tried it and it returns true for the taxonomy edit page so short of a module implementing hook_admin_paths and removing it that method should be pretty reliable
|
|
Oct 31, 2012 at 16:37 | comment | added | Chapabu |
Also - arg() being hard to read reference is here.
|
|
Oct 31, 2012 at 16:33 | comment | added | Chapabu |
How about popping a little && !path_is_admin(current_path()) in the if statement? I've not checked it yet, but term edit paths are admin pages, no :)
|
|
Oct 31, 2012 at 15:14 | comment | added | Clive♦ |
@AnilSagar Holy moly you're right :P I'm really not sure what the accepted way to do this is then, assuming I haven't made up that bit about arg() being less readable
|
|
Oct 31, 2012 at 15:10 | comment | added | Anil Sagar | I guess above code also get executed in taxonomy/term/id/edit & feed pages too !! We may need to check for third argument ? | |
Oct 31, 2012 at 14:57 | history | answered | Clive♦ | CC BY-SA 3.0 |