Support rendering entities in page mode

Created on 20 February 2011, over 13 years ago
Updated 16 August 2023, 11 months ago

We're duplicating code that could be generalized into one simple function:

node_is_page($node)
taxonomy_term_is_page($term)

Could just be the following:

/**
 * Returns whether the current page is the page of the passed in entity.
 *
 * @param $type
 *    The entity type; e.g. 'node' or 'user'.
 * @param $entity
 *    The entity object.
 *
 * @return
 *   TRUE if the current page is the page of the specified entity, or FALSE
 *   otherwise.
 */
function entity_is_page($type, $entity) {
  return (($uri = entity_uri($type, $entity)) && current_path() == $uri['path']);
}

Related issues

#721754: A node cannot be displayed in different view mode on its own page β†’

✨ Feature request
Status

Needs work

Version

9.5

Component
BaseΒ  β†’

Last updated 1 minute ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Dave Reid Nebraska πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Checking 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.

Production build 0.69.0 2024