public function addAction(BASE_ContextAction $action) { if ($action->getParentKey() == null) { $this->actions[$action->getKey()]['action'] = $action; } else { if (!empty($this->actions[$action->getParentKey()])) { $this->actions[$action->getParentKey()]['subactions'][$action->getKey()] = $action; } } if ($action->getOrder() === null) { $order = $action->getParentKey() === null ? count($this->actions) : count($this->actions[$action->getParentKey()]['subactions']); $action->setOrder($order); } }