aboutsummaryrefslogtreecommitdiffstats
path: root/include/comanche.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-02-25 20:58:20 -0800
committerfriendica <info@friendica.com>2014-02-25 20:58:20 -0800
commit364fc9f1638e67dad2c289b4d365753a5d06ac05 (patch)
treee12d07cd3e090488f1d8660b47633aa442b09a68 /include/comanche.php
parent1857036a994a5470aaece799d3bf07fbc863a91f (diff)
downloadvolse-hubzilla-364fc9f1638e67dad2c289b4d365753a5d06ac05.tar.gz
volse-hubzilla-364fc9f1638e67dad2c289b4d365753a5d06ac05.tar.bz2
volse-hubzilla-364fc9f1638e67dad2c289b4d365753a5d06ac05.zip
comanche: provide an option to add a menu class for different theming choices on some menus (e.g. horizontal, tabbed, etc.)
Diffstat (limited to 'include/comanche.php')
-rw-r--r--include/comanche.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/comanche.php b/include/comanche.php
index 7d7e0e70c..f02190ee5 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -79,10 +79,10 @@ function comanche_parser(&$a,$s) {
}
-function comanche_menu($name) {
+function comanche_menu($name,$class = '') {
$a = get_app();
$m = menu_fetch($name,$a->profile['profile_uid'],get_observer_hash());
- return menu_render($m);
+ return menu_render($m,$class);
}
function comanche_replace_region($match) {
@@ -152,13 +152,22 @@ function comanche_widget($name,$text) {
function comanche_region(&$a,$s) {
-
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$s = str_replace($mtch[0],comanche_menu(trim($mtch[1])),$s);
}
}
+
+ // menu class e.g. [menu=horizontal]my_menu[/menu] or [menu=tabbed]my_menu[/menu]
+ // allows different menu renderings to be applied
+
+ $cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $s = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$match[1]),$s);
+ }
+ }
$cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {