Support rendering entities in page mode

Created on 20 February 2011, almost 14 years ago
Updated 16 August 2023, over 1 year 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 2 days ago

Created by

🇺🇸United States dave reid Nebraska USA

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.71.5 2024