Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change our menu building blocks to use PHP templates so that themes
can override them and define their own menu formats. I worry a little bit that this approach may be too heavy since we're now doing a lot more template includes than we were before. Also, I had to change the Menu API to stop using __toString() because you can't throw exceptions from __toString() which would make it an unhappy experience for developers.
- Loading branch information
Showing
7 changed files
with
74 additions
and
53 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
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,23 @@ | ||
<?php defined("SYSPATH") or die("No direct script access.") ?> | ||
<? if ($menu->is_root): ?> | ||
|
||
<ul class="<?= $menu->css_class ?>"> | ||
<? foreach ($this->elements as $element): ?> | ||
<?= $element->render() ?> | ||
<? endforeach ?> | ||
</ul> | ||
|
||
<? else: ?> | ||
|
||
<li title="<?= $menu->label->for_html_attr() ?>"> | ||
<a href="#"> | ||
<?= $menu->label->for_html() ?> | ||
</a> | ||
<ul> | ||
<? foreach ($this->elements as $element): ?> | ||
<?= $element->render() ?> | ||
<? endforeach ?> | ||
</ul> | ||
</li> | ||
|
||
<? endif ?> |
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,10 @@ | ||
<?php defined("SYSPATH") or die("No direct script access.") ?> | ||
<li> | ||
<a id="<?= $menu->css_id ?>" | ||
class="g-ajax-link <?= $menu->css_class ?>" | ||
href="<?= $menu->url ?>" | ||
title="<?= $menu->label->for_html_attr() ?>" | ||
ajax_handler="<?= $menu->ajax_handler ?>"> | ||
<?= $menu->label->for_html() ?> | ||
</a> | ||
</li> |
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,9 @@ | ||
<?php defined("SYSPATH") or die("No direct script access.") ?> | ||
<li> | ||
<a id="<?= $menu->css_id ?>" | ||
class="g-dialog-link <?= $menu->css_class ?>" | ||
href="<?= $menu->url ?>" | ||
title="<?= $menu->label->for_html_attr() ?>"> | ||
<?= $menu->label->for_html() ?> | ||
</a> | ||
</li> |
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,9 @@ | ||
<?php defined("SYSPATH") or die("No direct script access.") ?> | ||
<li> | ||
<a id="<?= $menu->css_id ?>" | ||
class="g-menu-link <?= $menu->css_class ?>" | ||
href="<?= $menu->url ?>" | ||
title="<?= $menu->label->for_html_attr() ?>"> | ||
<?= $menu->label->for_html() ?> | ||
</a> | ||
</li> |