This is a rather strange one that I was only able to replicate when enabling other modules (such as the 'Feeds' module) but irregardless; the issue does appear to be with this module as altering the code locally fixes it.

To Replicate:
* Enable the Devel module
* Enable the Feeds module
* At this point you should be met with an error and be unable to access your site

I did some investigating and noticed the problem appears to originate in devel.module when setting the link template (in devel_entity_type_alter()). I did a var_dump of the values of getLinkTemplate() and sometimes the value is not preceded by a / as is required (see EntityType::setLinkTemplate()).

I have altered the code slightly to check if the value doesn't start with a / and if so to prepend it with one.

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marc.groth’s picture

Patch attached.

After applying this patch I am unable to replicate any issues. It would be good to get this reviewed/committed if at all possible.

Happy to fix up any issues if there are any.

Cheers,

Marc

marc.groth’s picture

Status: Active » Needs review

Updating status.

Status: Needs review » Needs work

The last submitted patch, 1: devel-link_templates-2444077-2.patch, failed testing.

marc.groth’s picture

Whoops! I patched it in the wrong context. Re-applying patch...

marc.groth’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: devel-link_templates-2444077-4.patch, failed testing.

marc.groth’s picture

Status: Needs work » Needs review

Hmm the issue now seems to be with the tests and not the patch itself, so updating the status again.

willzyx’s picture

Status: Needs review » Closed (works as designed)

@marc.groth I think the problem should be addressed to Feeds module

In Feeds code i see

\Drupal\feeds\Entity\FeedType

 *   links = {
 *     "edit-form" = "entity.feeds_feed_type.edit_form",
 *     "delete-form" = "entity.feeds_feed_type.delete_form"
 *   },

and \Drupal\feeds\Entity\Feed

 *   links = {
 *     "canonical" = "entity.feeds_feed.canonical",
 *     "delete-form" = "entity.feeds_feed.delete_form",
 *     "edit-form" = "entity.feeds_feed.edit_form",
 *     "admin-form" = "entity.feeds_feed_type.edit_form",
 *     "import-form" = "entity.feeds_feed.import",
 *     "clear-form" = "entity.feeds_feed.clear"
 *   }

The links definition should be changed as per #2281645: Make entity annotations use link templates instead of route names.

Feel free to reopen if you think that this issue must be addressed to devel

marc.groth’s picture

Status: Closed (works as designed) » Active

Hey @willzyx

Thanks for such a speedy response!

I had a look and as far as I can tell the URL's all start with / in the Feeds module. Bare in mind that entity.feeds_feed.canonical (for example) refers to the route and if you look in the feeds.routing.yml file you'll see that the URL does indeed start with /. In fact I checked and they all do.

The reason I think this is an issue with the devel module is because when I did a var_dump() in the setLinkTemplate() function, the only ones coming back with URL's not starting with / were devel-related ones.

I'm not too familiar with either of these modules (or D8 for that matter) so I could be completely wrong; but could you just double check again? Also review the patch if you could, which is very minor and as I say just checks for / before attempting to call the setLinkTemplate() function.

Let me know if you need any further investigation.

Cheers,

Marc

marc.groth’s picture

Status: Active » Closed (works as designed)

Forgive me... I didn't properly read the thread you sent. I didn't realise you can't reference route names and instead have to use actual links.

And it's only Monday....... haha :)