Last active
April 5, 2018 14:49
-
-
Save laoneo/5f024c9d055cff7b79b01a641971574a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function build(&$query) | |
{ | |
$this->updateEventParent($query); | |
return parent::build($query); | |
} | |
public function parse(&$segments) | |
{ | |
$this->updateEventParent(); | |
return parent::parse($segments); | |
} | |
private function updateEventParent($query = null) | |
{ | |
$active = $this->menu->getActive(); | |
$items = $this->menu->getItems('component', 'com_dpcalendar'); | |
if ($active && $active->component == 'com_dpcalendar') { | |
array_unshift($items, $active); | |
} | |
foreach ($items as $item) { | |
if (!$item || empty($item->query['view']) || empty($this->views[$item->query['view']])) { | |
continue; | |
} | |
if ($query && !empty($query['Itemid']) && $query['Itemid'] != $item->id) { | |
continue; | |
} | |
$this->views['event']->setParent($this->views[$item->query['view']]); | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment