Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot attach view to teams #958

Closed
boobaa opened this issue Oct 12, 2023 · 3 comments · Fixed by #995
Closed

Cannot attach view to teams #958

boobaa opened this issue Oct 12, 2023 · 3 comments · Fixed by #995
Labels
bug Something isn't working

Comments

@boobaa
Copy link
Contributor

boobaa commented Oct 12, 2023

Description

When visiting a view page with the path set to /teams/%team/articles, I get a WSOD.

Apigee Info

Using Apigee Edge/OPDK.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Add a multivalue entityreference field for team entities to the Article content type.
  2. Add some Article nodes referencing some teams.
  3. Add a view that lists Article nodes with a contextual filter on the just-created field.
  4. Add a page display with the Path set to /teams/%team/articles, preferably with the Menu Type set to "Menu tab" with the "Menu link title" being "Articles" (for easier navigation).
  5. Visit a team that is referenced from an Article node.
  6. Click on its "Article" tab (created by the just-created view's display).

Actual Behavior

WSOD, with this in the logs:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getStatus() on string in apigee_edge_teams_preprocess() (line 203 of modules/contrib/apigee_edge/modules/apigee_edge_teams/apigee_edge_teams.module).
apigee_edge_teams_preprocess()
call_user_func_array() (Line: 287)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 446)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 56)
__TwigTemplate_7273d8dcbb0b740ab722bd56aa5f0ac9->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 79)
__TwigTemplate_8e9607f8939269395c720372194b8b8c->block_content() (Line: 182)
Twig\Template->displayBlock() (Line: 67)
__TwigTemplate_8e9607f8939269395c720372194b8b8c->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 446)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 54)
__TwigTemplate_3d8a3c19cbc8e25cdc7142d367e43917->block_region_content() (Line: 182)
Twig\Template->displayBlock() (Line: 43)
__TwigTemplate_3d8a3c19cbc8e25cdc7142d367e43917->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 180)
__TwigTemplate_cbf5f29beb4dcb52af57943c00f0b946->block_page_main() (Line: 182)
Twig\Template->displayBlock() (Line: 69)
__TwigTemplate_cbf5f29beb4dcb52af57943c00f0b946->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 86)
__TwigTemplate_16f1c92c0132cc11a2428c0f8f55b8a1->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 162)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 163)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Expected Behavior

A Views page that lists all the Article nodes referencing the current team.

Screenshots

n/a

Notes

The apigee_edge_teams.module:203 reads:

  if (!$team || $team->getStatus() !== TeamInterface::STATUS_INACTIVE) {

When the error occurs, parameter upcasting did not happen, thus $team is a string and not a Team object. The error is gone if this line is changed to:

  if (!($team instanceof TeamInterface) || $team->getStatus() !== TeamInterface::STATUS_INACTIVE) {

Version Info

drupal/core                                               9.5.11          Drupal is an open source content management platform powering millions of websites and applications.
drupal/apigee_edge                                        2.1.0           Apigee Edge for Drupal.
@boobaa boobaa added the bug Something isn't working label Oct 12, 2023
@boobaa
Copy link
Contributor Author

boobaa commented Oct 12, 2023

Attaching the above suggestion as a patch.
apigee_edge-cannot_attach_view_to_teams-GH958.patch.txt

@divya-intelli
Copy link
Collaborator

Thank you @boobaa for addressing the issue.
We are able to replicate.
Please create a PR with the fix so that we can review and test.

@divya-intelli
Copy link
Collaborator

divya-intelli commented Nov 21, 2023

@boobaa , the patch looks good. Please create PR with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants