Permalink
Browse files

Streamline bind_to api

  • Loading branch information...
flack committed Dec 6, 2018
1 parent 00fa8b9 commit 6cfb9fceda1f1051e5fe014b5e9baa101db604dd
Showing with 3 additions and 13 deletions.
  1. +1 −9 lib/midcom/services/metadata.php
  2. +2 −4 lib/midgard/admin/asgard/plugin.php
@@ -142,15 +142,7 @@ public function get_object_classes($object, $existing_classes = null)
*/
public function bind_to($object)
{
$this->bind_metadata_to_object($object);
}
/**
* Binds object to given metadata type.
*/
public function bind_metadata_to_object($object, $context_id = null)
{
$context = midcom_core_context::get($context_id);
$context = midcom_core_context::get();
$this->_metadata[$context->id] = midcom_helper_metadata::retrieve($object);
if (!$this->_metadata[$context->id]) {
@@ -79,13 +79,11 @@ public static function bind_to_object($object, $handler_id, array &$data)
// Populate toolbars
if (midcom::get()->dbclassloader->is_midcom_db_object($object)) {
$context = midcom_core_context::get();
// Bind the object to the metadata service
midcom::get()->metadata->bind_metadata_to_object($object, $context->id);
midcom::get()->metadata->bind_to($object);
// These toolbars only work with DBA objects as they do ACL checks
$view_toolbar = midcom::get()->toolbars->get_view_toolbar($context->id);
$view_toolbar = midcom::get()->toolbars->get_view_toolbar();
$view_toolbar->bind_to($object);
$data['asgard_toolbar']->bind_to_object($object, $handler_id, $data);
self::_set_object_breadcrumb($object, $handler_id, $data);

0 comments on commit 6cfb9fc

Please sign in to comment.