Created on 21 February 2023, about 2 years ago

Problem/Motivation

For edit there is direct link like :

/paragraphs_edit/node/{{ nid }}/paragraphs/{{ id }}/edit

I would like to have also delete link, is that possible to implement ? - When I visit the paragraph with above link ,the delete button is missing there so delete button would be nice to have or any direct link if possible.

πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia coaston

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @coaston
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    a.dmitriiev β†’ made their first commit to this issue’s fork.

  • Merge request !3Issue #3343465: Delete link β†’ (Open) created by a.dmitriiev
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update almost 2 years ago
    Waiting for branch to pass
  • Status changed to Needs review almost 2 years ago
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    According to this comment https://www.drupal.org/project/paragraphs/issues/3238515#comment-14951479 πŸ’¬ No link template 'canonical' found for the 'paragraph' entity type Fixed each module is responsible to check whether canonical url exists for paragraphs. So for delete form this should be checked inside the module. Please review MR

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update almost 2 years ago
    Waiting for branch to pass
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update almost 2 years ago
    Waiting for branch to pass
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update almost 2 years ago
    Waiting for branch to pass
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    I found one more issue, when deleting paragraph that is a child of another paragraph. The shouldCreateNewRevision should be checked on root parent and not immediate parent of the paragraph. MR was updated

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡³πŸ‡±Netherlands timohuisman Leiden, Netherlands

    I'm not sure that I understand the problem, is the issue summary up-to-date? I've just tested the url /paragraphs_edit/node/{{ nid }}/paragraphs/{{ id }}/delete and I was able to delete a existing paragraph. Could you provide more detailed steps to reproduce this issue?

  • Status changed to Needs review over 1 year ago
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    My setup:

    • Drupal 10.1.6
    • Paragraphs 8.x-1.16
    • Paragraph Edit 8.x-2.0

    Try to open url like this /paragraphs_edit/node/122/paragraphs/5923/delete and you will see this error:

    Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template 'canonical' found for the 'paragraph' entity type in Drupal\Core\Entity\EntityBase->toUrl() (Zeile 196 in /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php).

    This is happening due to getCancelUrl that calls by default $entity->toUrl() that has 'canonical' as default argument. And Paragraphs do not have 'canonical' template.

    Make sure that your installation has no modules that overwrite the Paragraph Delete Form, like frontend_editing.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    I can confirm the error.
    It happens if the delete route for paragraphs doesn't have destination query parameter.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Lets start with retargetting.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Reading the code im a little confused why the ->delete was added. Wasn't it deleting before but only unlinking?

  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    It was only unlinking the paragraph from the host (parent) entity. If you check the class ContentEntityDeleteForm in submitForm there is a line $entity->delete(). But ParagraphDeleteForm overwrites this method but doesn't implement delete(), so the paragraph is still there.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Hmm, fair enough. But what if a paragraph is linked to another entity? This would mean delete for all. That feels dagerous.

  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    Paragraph is not a re-usable entity, because it has a parent and a parent field defined in the base fields of paragraph itself, so theoretically it can't be added to another entity. I am not sure how paragraphs library works, though. This needs to be confirmed.

Production build 0.71.5 2024