jinjie / duplicate-dataobject

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

Update Title when duplicating #1

Closed jinjie closed 5 years ago

jinjie commented 5 years ago

Add an option that that will change the title.

For example, when duplicating a DO with Title, will create a duplicate of the DO with title of Title (copy)

wernerkrauss commented 5 years ago

IMHO this should be solved in each DataObject class in the method onBeforeDuplicate(), like

public function onBeforeDuplicate()
{
    $this->Title .= ' (copy)';
}
jinjie commented 5 years ago

Thanks @wernerkrauss for pointing this out. Yes. I do agree that this should be done in onBeforeDuplicate()

Closing this issue.