From d261fe271fdee747244c76f7ba4679b8372a2e8c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Sep 2012 17:48:10 -0700 Subject: create a widget registry for pages so themes can reorder, insert/delete, and relocate widgets to different regions of the page --- boot.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index ae69ffacb..778e00cfc 100644 --- a/boot.php +++ b/boot.php @@ -369,6 +369,7 @@ if(! class_exists('App')) { public $account = null; private $channel = null; + private $widgets = array(); public $language; public $module_loaded = false; @@ -603,6 +604,20 @@ if(! class_exists('App')) { return $this->channel; } + function set_widget($title,$html, $location = 'aside') { + $this->widgets[] = array('title' => $title, 'html' => $html, 'location' => $location); + } + + function get_widgets($location) { + if($location && count($this->widgets)) { + $ret = array(); + foreach($widgets as $w) + if($w['location'] == $location) + $ret[] = $w; + return $ret; + } + return $this->widgets; + } function set_pager_total($n) { $this->pager['total'] = intval($n); @@ -1142,9 +1157,6 @@ function profile_load(&$a, $nickname, $profile = 0) { require_once($theme_info_file); } - if(! (x($a->page,'aside'))) - $a->page['aside'] = ''; - if(local_user() && local_user() == $a->profile['uid']) { $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'),array( '$editprofile' => t('Edit profile'), @@ -1154,7 +1166,7 @@ function profile_load(&$a, $nickname, $profile = 0) { $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); - $a->page['aside'] .= profile_sidebar($a->profile, $block); + $a->set_widget('profile',profile_sidebar($a->profile, $block)); /*if(! $block) $a->page['aside'] .= contact_block();*/ -- cgit v1.2.3