Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This isn't really a problem as it still works, but it does kick up a lot of warning messages in the log so I just thought I'd ask about it here. I've checked the fields and the views many times and they both seem to be setup correctly.
Does anyone have any ideas why this is happening? Will these constant log entries slow down the site once more users are on there?
Thanks in advance.
Comment | File | Size | Author |
---|---|---|---|
#13 | entityreference-view_is_no_longer_eligible-2476457-13.patch | 2.53 KB | alan-ps |
Comments
Comment #1
ron_s CreditAttribution: ron_s commentedI've noticed this too as of late. Seems to specifically be when users are editing forms that were previously saved, and the form has an Entity Reference field on it.
Haven't had the time to track down what might be causing it, but does not seem to cause functional issues.
Comment #2
ron_s CreditAttribution: ron_s commentedOk, just checked the code and this seems to be a bug. This is a case of limiting roles on a View, and in my case, combined with using Field Permissions on an Entity Reference field.
Only certain roles can access the Entity Reference view, and I'm using Field Permissions to limit who can access the field on the entity type. Admins have the ability to use and access the entity reference field, but regular authenticated users do not.
The problem stems from the code in the
initializeView
function inEntityReference_SelectionHandler_Views.class.php
:The line right before the watchdog statement is causing the issue. It says the message is to be written if
!$this->view->access($display_name)
. Unfortunately this will be the case for any entity reference field that has restricted Views roles, and uses the Field Permissions module to give access to select users.Modifying the issue title to more accurately reflect the problem.
Comment #3
ron_s CreditAttribution: ron_s commentedI see this same code exists in 7.x-1.x, so marking this as an issue with the -dev branch.
http://cgit.drupalcode.org/entityreference/tree/plugins/selection/Entity...
Comment #4
sozonov CreditAttribution: sozonov commentedAlso you should check views access permissions!
Comment #5
NWOM CreditAttribution: NWOM commentedThis problem also occurs when importing nodes via Feeds, even when the entity reference field is not mapped.
Comment #6
possiBriHas this been fixed in dev?
Comment #7
seanrIt has not - still seeing the same code for that function.
Comment #8
blueblot CreditAttribution: blueblot commentedI'm experiencing the same problem specifically when a user edits a form that was already saved.
I have an entity reference to users and the data in this reference is gone after the formedit.
Comment #9
Collins405 CreditAttribution: Collins405 commentedSame issue here, its actually not causing any functionality issues, just flooding Watchdog
Comment #10
Collins405 CreditAttribution: Collins405 commentedCan anyone have some input or suggestions for suppressing this error?
It's the same scenario for us, we use field permissions to restrict an entity reference field from certain roles, and whenever a user with the role creates an entity with that field, this error spams watchdog.
Comment #11
nickonom CreditAttribution: nickonom commentedYou need to adjust the view permissions. See https://drupal.stackexchange.com/questions/258358/views-roles-field-perm... for details.
Comment #12
NWOM CreditAttribution: NWOM commented@nickonom: This doesn't have anything to do with standard Views Access permissions.
Comment #13
alan-ps CreditAttribution: alan-ps as a volunteer and at Drupal Ukraine Community commentedThe issue is still present. It does kick up a lot of warning messages in the logs as mentioned in a description. So, I think it would be great to fix this.
The source of a problem was already described in #2. I would like to add that the access check (
!$this->view->access($display_name)
) was introduced here:https://www.drupal.org/project/entityreference/issues/1253776#comment-59....
The
access
function also determines if the given user has access to the view (not only if it is disabled), and this does not look as a point to log such warnings. We probably should fix this.Please check the patch attached to this comment. It should help with to solve this issue.