mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-56699 boost: Don't break when activities use onclick in nav
Boost templates were not nicely rendering onclick handlers in the navbar.
This commit is contained in:
parent
cad8adccc7
commit
88e709ae43
@ -255,27 +255,6 @@ class navigation_node implements renderable {
|
||||
return ($count > 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively walk the tree looking for a node with a valid action.
|
||||
* Depth first search.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resolve_action() {
|
||||
if ($this->action) {
|
||||
return $this->action;
|
||||
}
|
||||
if (!empty($this->children)) {
|
||||
foreach ($this->children as $child) {
|
||||
$action = $child->resolve_action();
|
||||
if (!empty($action)) {
|
||||
return $action;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of sibling navigation nodes at the same level as this one.
|
||||
*
|
||||
@ -807,6 +786,21 @@ class navigation_node implements renderable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action url for this navigation node.
|
||||
* Called from templates.
|
||||
*
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function action() {
|
||||
if ($this->action instanceof moodle_url) {
|
||||
return $this->action;
|
||||
} else if ($this->action instanceof action_link) {
|
||||
return $this->action->url;
|
||||
}
|
||||
return $this->action;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user