diff --git a/application/src/Controller/Admin/ItemController.php b/application/src/Controller/Admin/ItemController.php index 4d47869d4d..87ffed7dd7 100644 --- a/application/src/Controller/Admin/ItemController.php +++ b/application/src/Controller/Admin/ItemController.php @@ -200,6 +200,11 @@ public function editAction() return $this->getAddEditView(); } + public function copyAction() + { + return $this->getAddEditView(); + } + /** * Get the add/edit view. * @@ -214,7 +219,7 @@ protected function getAddEditView() $form->setAttribute('enctype', 'multipart/form-data'); $form->setAttribute('id', '$action-item'); - if ('edit' === $action) { + if ('edit' === $action || 'copy' === $action) { $item = $this->api()->read('items', $this->params('id'))->getContent(); } @@ -252,7 +257,7 @@ protected function getAddEditView() $view = new ViewModel; $view->setVariable('form', $form); - if ('edit' === $action) { + if ('edit' === $action || 'copy' === $action) { $view->setVariable('item', $item); $view->setVariable('resource', $item); } diff --git a/application/view/omeka/admin/item/copy.phtml b/application/view/omeka/admin/item/copy.phtml new file mode 100644 index 0000000000..36b1dfe045 --- /dev/null +++ b/application/view/omeka/admin/item/copy.phtml @@ -0,0 +1,25 @@ +plugin('translate'); +$escape = $this->plugin('escapeHtml'); +$this->htmlElement('body')->appendAttribute('class', 'add items'); +?> + + + +pageTitle("Copied from " . $item->displayTitle(), 1, $translate('Items')); ?> +trigger('view.add.before'); ?> +partial('omeka/admin/item/form.phtml', [ + 'form' => $form, + 'item' => $item, + 'resource' => $resource, + 'mediaForms' => $mediaForms, + 'submitLabel' => $translate('Add'), + 'sectionNavEvent' => 'view.add.section_nav', + 'action' => 'add', +]); +?> + +trigger('view.add.after'); ?>