<?php
$translate = $this->plugin('translate');
$escape = $this->plugin('escapeHtml');
$this->htmlElement('body')->appendAttribute('class', 'edit items');
$deleteButton = $item->userIsAllowed('delete')
    ? '<a href="#" class="delete button">' . $translate('Delete') . '</a>'
    : null;
?>

<script type='text/javascript'>
var valuesJson = <?php echo json_encode($item->values()); ?>;
</script>

<?php echo $this->pageTitle($item->displayTitle(), 1, $translate('Items'), $translate('Edit')); ?>
<?php $this->trigger('view.edit.before'); ?>
<?php
echo $this->partial('omeka/admin/item/form.phtml', [
    'form' => $form,
    'item' => $item,
    'resource' => $resource,
    'mediaForms' => $mediaForms,
    'submitLabel' => $translate('Save'),
    'deleteButton' => $deleteButton,
    'sectionNavEvent' => 'view.edit.section_nav',
    'action' => 'edit',
]);
?>

<?php echo $this->deleteConfirm($item, 'item')?>

<?php $this->trigger('view.edit.after'); ?>
