You are here

function entity_translation_admin_paths in Entity Translation 7

Implements hook_admin_paths().

File

./entity_translation.module, line 728

Code

function entity_translation_admin_paths() {
  $paths = array();
  foreach (entity_get_info() as $entity_type => $info) {
    if (isset($info['translation']['entity_translation']['path schemes']) && entity_translation_enabled($entity_type, NULL, TRUE)) {
      foreach ($info['translation']['entity_translation']['path schemes'] as $scheme) {
        if (!empty($scheme['admin theme'])) {
          if (isset($scheme['translate path'])) {
            $translate_path = preg_replace('|%[^/]*|', '*', $scheme['translate path']);
            $paths[$translate_path] = TRUE;
            $paths["{$translate_path}/*"] = TRUE;
          }
          if (isset($scheme['edit path'])) {
            $edit_path = preg_replace('|%[^/]*|', '*', $scheme['edit path']);
            $paths["{$edit_path}/*"] = TRUE;
          }
        }
      }
    }
  }
  return $paths;
}