Skip to content
Permalink
Browse files

Make deleted view more useful

  • Loading branch information...
flack committed Jun 4, 2019
1 parent 9144e48 commit 842fa19258b5bddbb918864e9f9e502598e315e5
@@ -7,6 +7,7 @@
*/
use midgard\portable\storage\connection;
use midcom\datamanager\datamanager;
/**
* Simple object deleted page
@@ -20,18 +21,19 @@ class midgard_admin_asgard_handler_object_deleted extends midcom_baseclasses_com
/**
* Handler for deleted objects
*
* @param mixed $handler_id The ID of the handler.
* @param string $guid The object's GUID
* @param array $data The local request data.
*/
public function _handler_deleted($guid, array &$data)
public function _handler_deleted($handler_id, $guid, array &$data)
{
$data['view_title'] = $this->_l10n->get('object deleted');
$this->add_breadcrumb($this->router->generate('welcome'), $this->_l10n->get($this->_component));
if (midcom::get()->auth->admin) {
$this->prepare_admin_view($guid);
midgard_admin_asgard_plugin::bind_to_object($data['object'], $handler_id, $data);
}
$data['view_title'] = $this->_l10n->get('object deleted');
$this->add_breadcrumb("", $data['view_title']);
return $this->get_response();
@@ -51,6 +53,7 @@ private function prepare_admin_view($guid)
$qb->add_constraint('guid', '=', $guid);
$this->_request_data['object'] = $qb->get_result(0);
$this->prepare_dm($type);
$this->_request_data['asgard_toolbar']->add_item([
MIDCOM_TOOLBAR_URL => $this->router->generate('trash_type', ['type' => $type]),
@@ -77,6 +80,22 @@ private function prepare_admin_view($guid)
$this->add_breadcrumb('', $label);
}
/**
* Loads the schemadb from the helper class
*
* @param string $type
*/
private function prepare_dm($type)
{
$schema_helper = new midgard_admin_asgard_schemadb($this->_request_data['object'], $this->_config, $type);
$schemadb = $schema_helper->create([]);
$datamanager = new datamanager($schemadb);
$datamanager
->set_storage($this->_request_data['object'])
->get_form(); // currently needed to add head elements
$this->_request_data['datamanager'] = $datamanager;
}
/**
* Output the style element for deleted objects
*
@@ -0,0 +1,3 @@
<div class="object_view">
<?php $data['datamanager']->display_view(); ?>
</div>
@@ -27,6 +27,9 @@ private function _generate_url($action, $object)
*/
public function bind_to_object($object, $handler_id, $data)
{
if ($handler_id == 'object_deleted') {
return;
}
$buttons = [];
// Show view toolbar button, if the user hasn't configured to use straight the edit mode
if ($data['default_mode'] === 'view') {

0 comments on commit 842fa19

Please sign in to comment.
You can’t perform that action at this time.