forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-69588 theme_boost: Use partial templates in boost.
This moves away from using escaped html injected into the template and uses partial templates instead.
- Loading branch information
1 parent
2d548e7
commit 56c34d7
Showing
13 changed files
with
297 additions
and
62 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
namespace core\navigation\output; | ||
|
||
use renderable; | ||
use renderer_base; | ||
use templatable; | ||
use custom_menu; | ||
|
||
/** | ||
* more menu navigation renderable | ||
* | ||
* @package core | ||
* @category navigation | ||
* @copyright 2021 onwards Adrian Greeve | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class more_menu implements renderable, templatable { | ||
|
||
protected $content; | ||
protected $navbarstyle; | ||
protected $hastabs; | ||
protected $haschildren; | ||
|
||
/** | ||
* Constructor for this class. | ||
* | ||
* @param object $content Navigation objects. | ||
* @param string $navbarstyle class name. | ||
* @param bool $hastabs If tabs are being used. | ||
* @param bool $haschildren The content has children. | ||
*/ | ||
public function __construct(object $content, string $navbarstyle, bool $hastabs = false, bool $haschildren = true) { | ||
$this->content = $content; | ||
$this->navbarstyle = $navbarstyle; | ||
$this->hastabs = $hastabs; | ||
$this->haschildren = $haschildren; | ||
} | ||
|
||
/** | ||
* Return data for rendering a template. | ||
* | ||
* @param renderer_base $output The output | ||
* @return array Data for rendering a template | ||
*/ | ||
public function export_for_template(renderer_base $output): array { | ||
$data = ['navbarstyle' => $this->navbarstyle, 'tabs' => $this->hastabs]; | ||
if ($this->haschildren) { | ||
if (!isset($this->content->children) || count($this->content->children) == 0) { | ||
$data = []; | ||
} | ||
$data['nodecollection'] = $this->content; | ||
} else { | ||
$data['nodearray'] = (array) $this->content; | ||
} | ||
|
||
return $data; | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.