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 df9c912 commit 03e97db
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Atk4\Ui;

use Atk4\Data\Model;

/**
* Place menu.
*/
Expand Down Expand Up @@ -55,14 +57,8 @@ public function addItem($item = null, $action = null)

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);
} else {
$item->on('click', null, $action);
}

return $item;
Expand Down

0 comments on commit 03e97db

Please sign in to comment.