jinjie / duplicate-dataobject

Adds a duplicate button to GridField in the CMS that enables duplicating of dataobjects
3 stars 7 forks source link

SilverStripe 4 Duplicate DataObject

Adds a duplicate button to GridField in the CMS that enables duplicating of dataobjects

Installation

composer require jinjie/ss4-duplicate-dataobject

Usage Example

This module uses the built in DataObject duplication.

See

// Add component on existing GridField
$fields->fieldByName('Root.Main.MyGridField')
    ->getConfig()
    ->addComponent(new GridFieldDuplicateAction());

// Add component on new GridField
$fields->push(
    GridField::create(
        'MyGridField',
        'MyGridField'
    )->addComponent(new GridFieldDuplicateAction())
);

Author

Developed by Jin Jie @ Swift DevLabs