Problem/Motivation
When you attach a view using the the Google News Sitemap formatter to a Page (screenshots added), and then you load that page, you will get a php error:
Error: Call to undefined function Drupal\views_googlenews\Plugin\views\style\_url() in Drupal\views_googlenews\Plugin\views\style\GoogleNews->attachTo() (line 41 of modules/contrib/views_googlenews/src/Plugin/views/style/GoogleNews.php)
Indeed the _url "temporary" method was removed in Drupal 8 (https://www.drupal.org/project/drupal/issues/2343669)
Steps to reproduce
- Go create a new view based on content
- Add a Page and a Feed display
- On the Feed view display, use the formatter and row plugins provided by this module ("Google News Feed" for the format and "Google News fields" for the row config).
- Set the Feed display to be attached to the page you created before.
- Save changes
- When you go to configure or view the Page, you will get "Oops, something went wrong. Check your browser's developer console for more details." in the view config page
- Inspecting the console error logs, you will see the php error mentioned here about the non-existing method "_url()"
- If you remove the feed attachment to the Page, the error goes away
Proposed resolution
Use the correct function in the attachTo() method.
Comments
Comment #2
anairamzapComment #4
anairamzapSet to Needs Review since a MR is provided.
Comment #5
raveen_thakur51 commented@anairamzap,
** I am also facing the same issue as you have mentioned. Please see my attached SS https://prnt.sc/Y712MmsO8Qqm
** I am using Drupal 10.1, PHP - 8.1, and composer 2.6.
** But after implementing the MR! the issue has been fixed. Thank You!!
Comment #6
berdirThis makes sense, but note that this feature makes no sense for this display. You don't attach google news to anything else, it's a standalone URL, there is no need for users to access it.
Comment #7
anairamzap@berdir would you recommend to remove that method entirely then?
If we do that I'm wondering what would happen with existing view displays that attach the Feed display to a Page.
Comment #8
oily commented@anairamzap I think that the method should be left now it is done. The README could be edited to say:
Comment #9
recrit commentedstatic patch for composer builds.
Comment #11
berdirNot sure how to prevent this being available as an attachment, the display type maybe. Merge this for now.