The "Clone" tab and functionality is added to every content type. On my site, I only want this feature available on one specific content type. I thought maybe this would be possible by manipulating the permissions of the module, but the user roles that would perform the cloning already have the 'administer nodes' and 'bypass node access' permission, so that method does not work.

It would be good to have a third party setting stored on content types that enables/disables it.

Note that the fix proposed in comment #13 for #2979426: Permissions not respected would not help this issue, since that fix still has 'administer nodes' allow anyone to clone any type.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bkosborne created an issue. See original summary.

kmakaveev’s picture

Any updates on this issue?

simeonkesmev’s picture

Status: Active » Needs review
StatusFileSize
new4.76 KB

Here's a patch & test for this.

Status: Needs review » Needs work

The last submitted patch, 3: 3075823_enable_per_content_type.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

simeonkesmev’s picture

Status: Needs work » Needs review
StatusFileSize
new4.79 KB

Updated patch.

Status: Needs review » Needs work

The last submitted patch, 5: 3075823_enable_per_content_type_2.patch, failed testing. View results

kpaxman’s picture

This functionality is important for us as well; we have a couple of our content types that should not be cloned, where everything else should. A developer on my team is trying this patch, and should update here after it's tested.

lily.yan’s picture

It seems work, but coding standards show error (Class name doesn't match filename; expected "class QuickNodeCloneAllowedBundlesTest"). The updated patch can fix this issue. I haven't done Kernel test, but it should be working.

lily.yan’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 8: updated_enable_per_content_type-3075823-8.patch, failed testing. View results

kpaxman’s picture

I hadn't realized that there were permissions that control this. In theory, the only reason you'd need this patch is if you want to disable cloning for users with the administrator role, which automatically gets all the permissions.

lily.yan’s picture

Status: Needs work » Needs review

I re-rolled the patch #8 and made a merge request.

DIJABLO’s picture

Posting patch here, so it can be used with composer patches

Status: Needs review » Needs work

The last submitted patch, 14: 96ac280896d521ee27aa038f0dfc6a7047d2e7d4.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

istryker’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new4.92 KB

Re-roll

ok-steve’s picture

nikhileshpaul’s picture

Tested #16 and works fine

shaktik’s picture

I tested #16 and it works fine.

markdorison made their first commit to this issue’s fork.

markdorison’s picture

Status: Reviewed & tested by the community » Needs review

#16 was no longer applying cleanly since the inclusion of #3334865: Make support for groups optional. We need the latest changes to be in an MR so that tests will run so I created a new branch with the changes from #16 adjusted so that they would apply.

jennypanighetti’s picture

After applying MR#30 to 8.x-1.x-dev, I get the following error.

Error message
Warning: foreach() argument must be of type array|object, null given in Drupal\Core\Render\Element\Checkboxes::valueCallback() (line 113 of core/lib/Drupal/Core/Render/Element/Checkboxes.php).

Drupal\Core\Render\Element\Checkboxes::valueCallback(Array, , Object)
call_user_func_array(Array, Array) (Line: 1285)
Drupal\Core\Form\FormBuilder->handleInputElement('quick_node_clone_node_setting_form', Array, Object) (Line: 1006)
Drupal\Core\Form\FormBuilder->doBuildForm('quick_node_clone_node_setting_form', Array, Object) (Line: 1076)
Drupal\Core\Form\FormBuilder->doBuildForm('quick_node_clone_node_setting_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('quick_node_clone_node_setting_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

markdorison’s picture

Status: Needs review » Needs work
jaydarnell’s picture

MR#30 seems to work great for 8.x-1.19

bluegeek9 made their first commit to this issue’s fork.

bluegeek9 changed the visibility of the branch 8.x-1.x to hidden.

bluegeek9’s picture

Assigned: Unassigned » bluegeek9
bluegeek9’s picture

Status: Needs work » Active
bluegeek9’s picture

I tried using AccessResult::forbidden(), but other checks are not performed if a user has 'bypass node access'.

I think we can use hook_link_alter to remove the 'Clone' task.

bluegeek9’s picture

Assigned: bluegeek9 » Unassigned

rpayanm made their first commit to this issue’s fork.