public function getContextMenu($data) { $items = array(); $order = 1; foreach ($data['contextMenu'] as $action) { $items[] = array_merge(array("group" => "newsfeed", 'label' => null, 'order' => $order, 'class' => null, 'url' => null, 'id' => null, 'attributes' => array()), $action); $order++; } $menu = new BASE_MCMP_ContextAction($items); return $menu->render(); }
protected function initList() { $itemGroups = array(); $buttons = array(); foreach ($this->items as $item) { if (isset($item["group"])) { if (empty($itemGroups[$item["group"]])) { $itemGroups[$item["group"]] = array("key" => $item["group"], "label" => isset($item["groupLabel"]) ? $item["groupLabel"] : null, "context" => array()); } $itemGroups[$item["group"]]["items"][] = $item; } else { $buttons[] = $this->prepareItem($item, "owm_btn_list_item"); } } $tplGroups = array(); foreach ($itemGroups as $group) { $contextAction = new BASE_MCMP_ContextAction($group["items"], $group["label"]); $tplGroups[] = $contextAction->render(); } $this->assign('groups', $tplGroups); $this->assign("buttons", $this->getSortedItems($buttons)); }