You are here

function redirect_entity_type_supports_redirects in Redirect 7.2

Same name and namespace in other branches
  1. 7 redirect.module \redirect_entity_type_supports_redirects()

Check if an entity type supports redirects.

Parameters

$entity_type: An entity type.

Return value

TRUE if the entity type has an uri callback and supports redirects, or FALSE otherwise.

3 calls to redirect_entity_type_supports_redirects()
redirect_entity_delete in ./redirect.module
Implements hook_entity_delete().
redirect_field_attach_form in ./redirect.module
Implements hook_field_attach_form().
redirect_field_extra_fields in ./redirect.module
Implements hook_field_extra_fields().

File

./redirect.module, line 292

Code

function redirect_entity_type_supports_redirects($entity_type) {
  $types =& drupal_static(__FUNCTION__);
  if (!isset($types)) {
    $types = array();
    foreach (entity_get_info() as $type => $entity_info) {
      $types[$type] = !empty($entity_info['uri callback']) && (!isset($entity_info['redirect']) || !empty($entity_info['redirect']));
    }
  }
  return isset($types[$entity_type]) ? $types[$entity_type] : FALSE;
}