Adds a simple API to determine if an Entity is publicly accessible or not.

/**
 * Determine if an entity is publicly visible.
 *
 * @param string $entity_type
 *   An entity type of $entity.
 * @param object $entity
 *   The entity object.
 * @param array $options
 *   An optional array of options to use when determining publicity.
 * @param array $data
 *   An optional array of additional data to use when determining publicity.
 *
 * @return bool
 *   TRUE if the entity is publicly visible, or FALSE otherwise.
 */
function entity_is_public($entity_type, $entity, array $options = array(), array $data = array())

This goes beyond simply checking entity_access() as an anonymous user, but also checks other conditions like the following:

  • Does the entity actually have a URI? Is the URI the frontpage path or a non-administrative path?
  • An optional check for requiring the entity to have a URL alias.
  • Is the entity going to be processed with the Rabbit hole module?

The module additionally provides an API for other modules to help determine if an entity is publicly accessible or not.

Supporting organizations: 
Development and maintenance

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • Project categories: Developer tools
  • Created by dave reid on , updated
  • shieldStable releases for this project are covered by the security advisory policy.
    Look for the shield icon below.

Releases