I'm getting strange warnings about missing files in Entityreference module and vast majority of my views are not showing up on the website:

Warning: include_once(/home/mysite/public_html/sites/all/modules/entityreference/entityreference.views.inc) 
[function.include-once]: failed to open stream: No such file or directory in theme()
 (line 957 of /home/mysite/public_html/includes/theme.inc).
Warning: include(/home/mysite/public_html/sites/all/modules/entityreference/views-view-unformatted.tpl.php) 
[function.include]: failed to open stream: No such file or directory in
theme_render_template() (line 1397 of /home/mysite/public_html/includes/theme.inc).
The strange thing is that entityreference.views.inc file is acctualy located in .../entityreference/views/ folder.

To remedy this I just moved entityreference.views.inc to .../entityreference/ folder. I also created blank views-view-unformatted.tpl.php file and put that file to .../entityreference/ folder.

That worked, I'm not getting any warnings, my views are working, but I'm not happy with that solution. Just want to know why is this happening and how can I fix it properly without hacking the module?

Comments

daniel_j’s picture

The "path" and "theme path" elements in entityreference_views_plugins() need to be set (this function is declared in views/entityreference.views.inc). Views isn't smart enough to use the 'path' member declared in hook_views_api() to look for plugins, so the path has to be explicitly declared.

daniel_j’s picture

Version: 7.x-1.0 » 7.x-1.1
Category: Task » Bug report
daniel_j’s picture

StatusFileSize
new1.69 KB
daniel_j’s picture

Status: Active » Needs review
Jeroen94’s picture

I'm having exactly the same problem and solved it by moving the entityreference.views.inc file to the requested folder. I applied the patch, but it didn't fully work for me. I'm still getting the following errors:

Warning: include(C:\wamp\www\mysite/sites/all/modules/entityreference/views/views-view-unformatted.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1517 of C:\wamp\www\mysite\includes\theme.inc).

Warning: include(): Failed opening 'C:\wamp\www\mysite/sites/all/modules/entityreference/views/views-view-unformatted.tpl.php' for inclusion (include_path='.;C:\php\pear') in theme_render_template() (line 1517 of C:\wamp\www\mysite\includes\theme.inc).

Jeroen94’s picture

Title: included files are missing in entityreference module » Paths to included files are missing
Version: 7.x-1.1 » 7.x-1.2

Still a problem in the latest version 7.x-1.2. Clearing caches removes the errors that I got 2 years ago.

dasginganinja’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
StatusFileSize
new175 bytes

I am experiencing also this particular issue on an install and I can't seem to figure out what the cause of this is. When applying the patch above in #3 I was able to get the errors on cache clear to go away but the errors surrounding the views templates were still present. I have found a solution though.

The solution for this is to simply move the entityreference.views.inc file from /views to /. I have attached a patch against 7.x-1.2+13-dev / latest 7.x-1.x-dev that fixes this behavior in all cases that I have seen to date.

dasginganinja’s picture

I stand corrected. I attempted this on a multisite installation and the results were troubling at best. After moving the file to the root directory of the module, the views I had on the sites with existing relations were now broken and not resolving the correct file.

Approaching it from the start, my warnings that I receive are as follow:

Warning: include_once(/usr/share/drupal7/sites/all/modules/entityreference/entityreference.views.inc): failed to open stream: No such file or directory in theme() (line 1070 of /usr/share/drupal7/includes/theme.inc).
Warning: include_once(): Failed opening '/usr/share/drupal7/sites/all/modules/entityreference/entityreference.views.inc' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in theme() (line 1070 of /usr/share/drupal7/includes/theme.inc).
Warning: include(/usr/share/drupal7/sites/all/modules/entityreference/views-view-unformatted.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1530 of /usr/share/drupal7/includes/theme.inc).
Warning: include(): Failed opening '/usr/share/drupal7/sites/all/modules/entityreference/views-view-unformatted.tpl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in theme_render_template() (line 1530 of /usr/share/drupal7/includes/theme.inc).

The issue here is that the theme path for the views plugin is not set. The patch in #3 is on the right track but we need to give it the path to views, where the template for views_view_unformatted is located. After looking at the latest -dev it appears that there is just one location where this needs to be updated.

I have attached this new patch and it would be great if somebody could review it. I have tested this now on my multisite installation with great results on existing sites.

Please review!

dasginganinja’s picture

StatusFileSize
new641 bytes
Jeroen94’s picture

Status: Needs review » Reviewed & tested by the community

The problem persists in 7.x-1.3, but the patch in #9 seems to solve it!

joseph.olstad’s picture

still applies to 7.x-1.4 / 7.x-1.x dev
+1 thanks

minoroffense’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.