Add ability to disable the cloning option and form

Created on 23 December 2021, almost 3 years ago
Updated 4 December 2023, 12 months ago

Problem/Motivation

Clone form is not user friendly, we'd like to disable it for our clients, so they don't have to mess with types and bundles etc.

Steps to reproduce

Proposed resolution

Add permissions to use each forms.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Merge request !73255774 - Add new permissions β†’ (Open) created by AstonVictor
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 12 months ago
    Waiting for branch to pass
  • Status changed to Needs review 12 months ago
  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Created a new MR.

    Added edit/clone/delete permissions and implemented custom access callbacks for routes that check both the permission and entity access.

    Note that all new permissions are disabled by default. So, after merging changes, all contextual links will by hidden.
    I guess it's better to merge changes to the next release e.g. 4.0.x

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 12 months ago
    Waiting for branch to pass
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Hmm, yeah that is kinda breaking then. Wouldnt the correct path be adding an upgrade hook that adds the permission to the roles currently having that permission? Then its non breaking and can be disabled if you like.

  • πŸ‡©πŸ‡ͺGermany axroth Stuttgart

    + 1 for the permission approach with update hook

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 10 months ago
    Waiting for branch to pass
  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    Implemented an update hook to set permissions for users with authenticated role.

  • Status changed to Needs work 4 months ago
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Tryinig to get through all issues.

    Should the permission migration be different? Wouldnt the user need like content edit permsissions, the authenticated role seems a little optimistic, this could also be a user that can just login to comment or something?

  • πŸ‡¬πŸ‡§United Kingdom joehuggans Harrogate, UK

    For the time-being, if anyone wants to disable the contextual link to the clone form, then using this in a custom module works. (You have to log out and back in and possibly clear cache for it to take effect)

    /**
     * Implements hook_contextual_links_alter().
     */
    function MODULE_contextual_links_alter(array &$links, $group, array $route_parameters) {
      if ($group == 'paragraph') {
        if (isset($links['paragraphs_edit.clone_form'])) {
          unset($links['paragraphs_edit.clone_form']);
        }
      }
    }
    
Production build 0.71.5 2024