protectedPath = protectedPath.replace(projectPath, "")
.replaceAll("/controllers/[a-zA-Z0-9_]+?.(php|tpl)+", "");
Method method = elementClass.getMethod("getValueRange");
Object obj = method.invoke(element);
TextRange textRange = (TextRange) obj;
Class _PhpPsiElement = elementClass.getSuperclass().getSuperclass().getSuperclass();
Method phpPsiElementGetText = _PhpPsiElement.getMethod("getText");
Object obj2 = phpPsiElementGetText.invoke(element);
String str = obj2.toString();
String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
int start = textRange.getStartOffset();
int len = textRange.getLength();
String controllerName = YiiRefsHelper.getControllerClassName(path);
if (controllerName != null) {
if (baseDir != null) {
String inThemeFullPath = viewPathTheme + controllerName + "/" + uri
+ (uri.endsWith(".tpl") ? "" : ".php");
if (baseDir.findFileByRelativePath(inThemeFullPath) != null) {
viewPath = viewPathTheme;
}
VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
VirtualFile protectedPathDir = (!protectedPath.equals("")) ?
baseDir.findFileByRelativePath(protectedPath) : null;
if (appDir != null) {
PsiReference ref = new ViewsReference(controllerName, uri, element,
new TextRange(start, start + len), project, protectedPathDir, appDir);
return new PsiReference[]{ref};
}
}
return PsiReference.EMPTY_ARRAY;
}