When adding and viewing a new View for listing entity_subqueue entities, the following fatal error occurs:

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'entity_subqueue' entity type in Drupal\Core\Entity\Entity->toUrl() (line 225 of /var/www/drupal8/php/web/core/lib/Drupal/Core/Entity/Entity.php).

Adding the canonical link to the entity links definition fixes the issue.

 *   links = {
 *     "canonical" = "/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}",
 *     "edit-form" = "/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}",
 *     "delete-form" = "/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}/delete",
 *     "collection" = "/admin/structure/entityqueue/{entity_queue}/list",
 *   },

Comments

davidwhthomas created an issue. See original summary.

davidwhthomas’s picture

Status: Active » Needs review
StatusFileSize
new689 bytes

Here's the patch

davidwhthomas’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: 2983748-entity-subqueue-canonical-url.patch, failed testing. View results

davidwhthomas’s picture

Just noting, the test failure appears unrelated to the patch instead:

queue name & id mismatch: tests/modules/entityqueue_test/config/install/entityqueue.entity_queue.test.yml > id: test_queue

I imagine the file should be named entityqueue.entity_queue.test_queue.yml
or the id should be just test

davidwhthomas’s picture

Ah, wrote too soon on this one. It fixes the error, but turns the edit form into a read-only type display.
Looks like we'll need a separate route for the canonical entity subqueue url instead of sharing the edit-form.

sagesolutions’s picture

When adding and viewing a new View for listing entity_subqueue entities, the following fatal error occurs

I could not reproduce this error. I made a simple queue, and a 'multiple subqueue' entity queue. I added some content to each queue.

Next, I went to /admin/structure/views/add and selected Entity subqueue in the "View Settings" section, and created a page.

I clicked save, and went to the page, and had no issues.

I'm on the 8.x-1.x branch for entityqueue (Currently on the commit caeff5d96411a9ceceddf3d12343844eb228838f on Jul 11, 2018)
I'm running Drupal 8.5.5

sagesolutions’s picture

Status: Needs work » Needs review

Update:

I switched to Drupal 8.6-dev, and I still cannot reproduce this bug.
@davidwhthomas, can you still reproduce this?

amateescu’s picture

Status: Needs review » Closed (duplicate)

Duplicate of #2862628: No link template 'canonical' found for the 'entity_subqueue' entity type. There was a core bug which fixed a similar thing: #2479377: content_translation_page_attachments() should check for a canonical link before generating a URL to it so I assume somewhere in the codebase of your project you have a similar situation with a module (or even core) which doesn't check if a canonical link template actually exists before doing its work.

davidwhthomas’s picture

Thanks for the update!

I'm running v8.5.4

I'll double check it again with the custom view, perhaps ok for now.