- Issue created by @uv516
- š®š³India libbna New Delhi, India
Hi @uv516, before I start working on this, Iād like to confirm the steps to reproduce the issue. Once I make the necessary changes, I want to ensure I can verify whether the issue is resolved. Could you please share the exact steps to reproduce the issue?
- š©š°Denmark uv516 Denmark
It's fairly basic:
When a reference field has been created, a views reference with an associated display name must be used.
The view's machine name is unique and the display name is unique (machine names).
You create a view with an entity reference that can display results for an entity reference field.
If the view disappears for some reason or the machine name is changed, "our function" will display the error text "The reference view %view_name cannot be found". That's ok.
If the display (in the view) is deleted for some reason or (NOTE:) the display's machine name is changed, exactly the same error is displayed: "The reference view %view_name cannot be found". The problem is that it's actually not the right error. The view exists! and the view can be found, but it's the display's machine name that can't be found. The error text doesn't point to the actual error, but to the (existing) view that contains the display.
The code uses "!$this->view
", which refers to whether the parent view exists. The code!$this->view->access($display_name)
refers to whether the display is accessible with $display_name. So two different errors with the same error text.
In my proposal, I distinguish between the two error types, simply because I thought that my display should have a different machine name, which is why I changed the display's machine name. The result was that my reference field could not find the display even though it found the view.
For a long time I was surprised that I was told that the view could not be found, when it was there, and only after a while did I find out that it was actually the display that was "missing" (= had been given a different machine name). Therefore, it would have saved me a few hours of searching if the error text had immediately led me to the conclusion that it was the display that could not be found and that I could thus quickly correct the machine name back to the original one (or change the reference field).
My proposal is simply to create one error text for the missing view and another error text for the missing display (inside the view).
Therefore: If a display cannot be "seen" by the reference field, the error message "In the reference view "%view_name", the display "%display_name" cannot be found." will appear. This will tell the programmer that there is an error in the existing view with the display %display_name. - š©š°Denmark uv516 Denmark
- Create a view
- Create a display (entity reference). (The machine name i automatic given.)
- Create a field of entity reference and referending to the view and display. (OK!)
- Change the machine name of the display. (Now i get the error "The reference view %view_name cannot be found.", but the view CAN be found, so the error message is confusing.)
- I am using a lot of time to search the error in different ways.
- I found that the displays machine name should not have been changed. I renamed it to the original name (+flush...)
- Now my reference filed again could see the view and the display.
I f I've godt "my" errortext "In the reference view "%view_name", the display "%display_name" cannot be found.", I would have saved a lot of time troubleshooting.
- š®š³India libbna New Delhi, India
Understood. Thanks @uv516 for all the information. I will raise the MR for this today.
- š®š³India libbna New Delhi, India
I encountered some issues with the original branch, so I decided to close it. I have now created a new branch, updated the base branch to 10.5, and pushed the changes accordingly as suggested.
Changing the status to needs review.
- šŗšøUnited States smustgrave
MRs should be pointed at 11.x and will need test coverage.
Also issue summary template appears to be missing.
- š®š³India libbna New Delhi, India
@smustgrave should I create a new MR for 11.x.dev or should I update branch of the current MR?
- š®š³India libbna New Delhi, India
I attempted to update the target branch of the merge request, but it appears to be causing issues ā the changes are not reflecting correctly. I believe the best course of action is to create a new branch based on 11.x and open a fresh merge request.