You are here

function redirect_entity_info_alter in Redirect 7

Same name and namespace in other branches
  1. 7.2 redirect.module \redirect_entity_info_alter()

Implements hook_entity_info_alter().

File

./redirect.module, line 257

Code

function redirect_entity_info_alter(&$info) {
  $default_paths = array(
    'node' => 'node/%node',
    'user' => 'user/%user',
    'taxonomy_term' => 'taxonomy/term/%taxonomy_term',
  );
  foreach ($default_paths as $entity_type => $default_path) {
    if (isset($info[$entity_type]) && !isset($info[$entity_type]['default path'])) {
      $info[$entity_type]['default path'] = $default_path;
    }
  }

  // Disable support for some entity types that cause problems.
  $unsupported_entity_types = array(
    'comment',
    'media',
  );
  foreach ($unsupported_entity_types as $unsupported_entity_type) {
    if (isset($info[$unsupported_entity_type])) {
      $info[$unsupported_entity_type]['redirect'] = FALSE;
    }
  }
}