Skip to content

Commit

Permalink
collect running callback triggers directly from render tree
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jul 24, 2021
1 parent baa3bdc commit de1780f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ public function removeAttr($property)
*/
public function jsUrl($page = [])
{
return $this->getApp()->jsUrl($page, false, $this->_getStickyArgs());
return $this->getApp()->jsUrl($page, false, array_merge($this->getRunningCallbackArgs(), $this->_getStickyArgs()));
}

/**
Expand All @@ -613,7 +613,24 @@ public function jsUrl($page = [])
*/
public function url($page = [])
{
return $this->getApp()->url($page, false, $this->_getStickyArgs());
return $this->getApp()->url($page, false, array_merge($this->getRunningCallbackArgs(), $this->_getStickyArgs()));
}

protected function getRunningCallbackArgs(): array
{
if ($this->issetOwner() && $this->getOwner() instanceof self) {
$args = $this->getOwner()->getRunningCallbackArgs();
} else {
$args = [];
}

foreach ($this->elements as $v) {
if ($v instanceof Callback && $v->isTriggered() && $v->canTrigger()) {
$args[Callback::URL_QUERY_TRIGGER_PREFIX . $v->getUrlTrigger()] = $v->getTriggeredValue();
}
}

return $args;
}

/**
Expand Down

0 comments on commit de1780f

Please sign in to comment.