Skip to content

Commit

Permalink
fix tutorial/actions.php demo ii
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Aug 20, 2022
1 parent e746df1 commit 92f296c
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,10 @@ public function addItem($item = null, $action = null)
$item = $this->add($item)->setElement('a');

if (is_string($action) || is_array($action)) {
$action = $this->url($action);
}

if (is_string($action)) {
$item->setAttr('href', $action);
}

if ($action instanceof JsExpressionable) {
$item->js('click', $action);
}

if ($action instanceof UserAction\ExecutorInterface) {
$item->on('click', $action);
$url = $this->url($action);
$item->setAttr('href', $url);
} else {
$item->on('click', null, $action);
}

return $item;
Expand Down

0 comments on commit 92f296c

Please sign in to comment.