0

I use the Symfony framework the first time and goes through several tutorials to create an own entity type. https://www.daggerhart.com/drupal-8-custom-entities-bundles/ or https://www.daggerhart.com/drupal-8-custom-entities-bundles/

Now runs all very well, but I didn`t get the operation links(edit/delete) in every row for the saved content. There is only a devel link. If I moved directly to the content like www.exapmle/mytest/{id}/edit or www.exapmle/mytest/{id}/delete I can saw the content, edit the content, delete the content and the tabs are shown. So I think I have the permission for that.

Any ideas?

mytest.routing.yml:

entity.mytest.delete_test:
  path: '/tested/{mytest}/delete'
  defaults:
    _entity_form: mytest.delete
    _title: 'Delete Test'
  requirements:
    _entity_access: 'mytest.delete'

mytest.php in src/Entity

* @ContentEntityType(
*   id = "mytest",
*   links = {
*     "canonical" = "/tested/{mytest}",
*     "delete-shop" = "/tested/{mytest}/delete",
*     "collection" = "/tested"
*   },
* )
1

Ok, after I found the documentation at drupal documentation I get it! The naming of the link list must be:

* @ContentEntityType(
*   id = "mytest",
*   links = {
*     "canonical" = "/tested/{mytest}",
*     "delete-form" = "/tested/{mytest}/delete", // EDIT! 
*     "collection" = "/tested"
*   },
* )

That's all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.