Needs work
Project:
Drupal core
Version:
main
Component:
base system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Feb 2011 at 07:30 UTC
Updated:
16 Aug 2023 at 21:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidComment #2
dave reidWe could easily backport this to Drupal 7 and mark node_is_page() and taxonomy_term_is_page() as deprecated.
Comment #4
dave reidRevised patch that falls back to checking menu_get_item() to fix two of the test failures. Still fails the breadcrumb test...
Comment #5
dave reidGah, so we're better off checking strpos(current_path(), $uri['path']) since that replicates the same behavior as menu_get_object(). This should pass the tests.
Comment #6
dave reidRealized this will cause paths like 'node/11' to match if node 1 is being passed in.
Comment #7
bleen commentedThe patch in #6 works well for me ... obvious win by generalizing the two functions.
RTBC from me if testbot turns green...
Comment #8
fagoBut that would match for node/1/edit too?
Instead of determining the context when it was already lost, I think we should pass the context top-down, e.g. add this to an option to a future API function like entity_view().
Also, I don't like the function name. The entity is no page - entity_view_is_page() would fit better imho.
Comment #9
dave reidYes, the current node_is_page( ) also matches 'node/1/edit' as well. This patch is merely joining together the functions into one function and then we can improve from there.
Comment #10
sunSee also #721754: A node cannot be displayed in different view mode on its own page
Comment #11
sunStandardizing on "entity" tag, which will be renamed to "Entity system".
Comment #12
damien tournoud commentedThose functions needs to go away. This information needs to be provided to the templates by a proper variable.
Comment #13
sbandyopadhyay commentedJust as entity_uri() allows for a bundle-specific callback (
$info['bundles'][$bundle]['uri callback']) to take precedence over the generic one for the entity type ($info['uri callback']), it would be great for entity_is_page() to likewise allow bundle-specific callbacks.Comment #14
fagoNow, as we have an entity render API I think we should introduce the $page parameter there. Checking for the uri is not sufficient also, as we might have multiple pages for an entity - we won't be able to backport this though.
entity API module has that in d7 at entity_view():
Comment #14.0
fagoUpdated issue summary.
Comment #27
smustgrave commentedChecking the state of D10 this may still be a valid feature request if anyone picks it up. Will need an issue summary update I imagine though.