PHPackages                             dhensby/silverstripe-copybutton - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dhensby/silverstripe-copybutton

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

dhensby/silverstripe-copybutton
===============================

Adds copy button to the GridField.

v3.0.0(2mo ago)18.5k↑145.3%42BSD-3-ClausePHPCI passing

Since Nov 14Pushed 1w ago1 watchersCompare

[ Source](https://github.com/dhensby/silverstripe-copybutton)[ Packagist](https://packagist.org/packages/dhensby/silverstripe-copybutton)[ RSS](/packages/dhensby-silverstripe-copybutton/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (4)Versions (19)Used By (2)

silverstripe-copybutton
=======================

[](#silverstripe-copybutton)

Adds a copy button to the GridField.

Requirements
------------

[](#requirements)

- SilverStripe ^6
- PHP ^8.3

Installation
------------

[](#installation)

```
composer require dhensby/silverstripe-copybutton
```

Usage
-----

[](#usage)

To add the button to the GridField, add `CopyButton` as a component. The most common place to do this is in a `ModelAdmin` by overriding `getEditForm()`:

```
use Unisolutions\GridField\CopyButton;

public function getEditForm($id = null, $fields = null)
{
    $form = parent::getEditForm($id, $fields);

    $form
        ->Fields()
        ->fieldByName($this->sanitiseClassName($this->modelClass))
        ->getConfig()
        ->addComponent(new CopyButton(), GridFieldEditButton::class);

    return $form;
}
```

### Display modes

[](#display-modes)

By default the copy button appears in the action menu dropdown for each row. Pass `true` to the constructor to render it as a standalone column button instead:

```
->addComponent(new CopyButton(true));
```

### Cascading duplications

[](#cascading-duplications)

The copy action makes an exact duplicate of the record. To also duplicate relations, configure cascading duplications on your `DataObject`:

See: [https://docs.silverstripe.org/en/6/developer\_guides/model/relations/#cascading-duplications](https://docs.silverstripe.org/en/6/developer_guides/model/relations/#cascading-duplications)

### Post-copy hook

[](#post-copy-hook)

To run custom logic after a record is copied (e.g. clearing certain relations), implement `onAfterDuplicate()` on the `DataObject` or an extension:

```
class MyDataObjectExtension extends DataExtension
{
    public function onAfterDuplicate(DataObject $original, bool $doWrite): void
    {
        // e.g. clear a relation on the new copy
        $this->owner->Tags()->removeAll();
    }
}
```

Maintainer
----------

[](#maintainer)

Originally authored by Elvinas Liutkevičius .
Currently maintained by [dhensby](https://github.com/dhensby).

License
-------

[](#license)

BSD — see [silverstripe.org/BSD-license](http://silverstripe.org/BSD-license)

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance93

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~598 days

Recently: every ~744 days

Total

8

Last Release

61d ago

Major Versions

v0.8.0 → v1.0.02015-01-14

1.x-dev → 2.0.0-alpha.12018-03-09

v2.0.0 → v3.0.02026-05-04

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/563596?v=4)[Daniel Hensby](/maintainers/dhensby)[@dhensby](https://github.com/dhensby)

---

Top Contributors

[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (32 commits)")[![elvinas-liut](https://avatars.githubusercontent.com/u/2812754?v=4)](https://github.com/elvinas-liut "elvinas-liut (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![uniun](https://avatars.githubusercontent.com/u/92462659?v=4)](https://github.com/uniun "uniun (7 commits)")[![ivoba](https://avatars.githubusercontent.com/u/471254?v=4)](https://github.com/ivoba "ivoba (4 commits)")[![yusuf](https://avatars.githubusercontent.com/u/90121?v=4)](https://github.com/yusuf "yusuf (2 commits)")[![micschk](https://avatars.githubusercontent.com/u/1005986?v=4)](https://github.com/micschk "micschk (2 commits)")[![sheadawson](https://avatars.githubusercontent.com/u/1166136?v=4)](https://github.com/sheadawson "sheadawson (2 commits)")[![purplespider](https://avatars.githubusercontent.com/u/329880?v=4)](https://github.com/purplespider "purplespider (1 commits)")[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (1 commits)")[![adiwidjaja](https://avatars.githubusercontent.com/u/280394?v=4)](https://github.com/adiwidjaja "adiwidjaja (1 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (1 commits)")[![Taitava](https://avatars.githubusercontent.com/u/13002142?v=4)](https://github.com/Taitava "Taitava (1 commits)")[![thomasbnielsen](https://avatars.githubusercontent.com/u/2331955?v=4)](https://github.com/thomasbnielsen "thomasbnielsen (1 commits)")

---

Tags

silverstripecopybutton

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dhensby-silverstripe-copybutton/health.svg)

```
[![Health](https://phpackages.com/badges/dhensby-silverstripe-copybutton/health.svg)](https://phpackages.com/packages/dhensby-silverstripe-copybutton)
```

###  Alternatives

[silverstripe/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[symbiote/silverstripe-gridfieldextensions

A collection of useful grid field components

951.9M273](/packages/symbiote-silverstripe-gridfieldextensions)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)[unisolutions/silverstripe-copybutton

Adds copy button to the GridField.

1736.5k](/packages/unisolutions-silverstripe-copybutton)[silverstripe/tagfield

Tag field for SilverStripe

561.3M50](/packages/silverstripe-tagfield)[jonom/silverstripe-betternavigator

Front-end utility menu for Silverstripe websites featuring administration and development tools

60435.1k13](/packages/jonom-silverstripe-betternavigator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
