@@ -35,26 +35,40 @@ public function setImage($image){
3535 $ this ->content ["image " ]=$ image ;
3636 }
3737
38- private function createContent (){
39- $ this ->content ["content " ]=new HtmlSemDoubleElement ("content- " .$ this ->identifier ,"div " ,"content " );
40- return $ this ->content ["content " ];
38+ private function _getContent ($ key ="content " ,$ baseClass ="content " ){
39+ if (\array_key_exists ($ key , $ this ->content )===false ){
40+ $ this ->content [$ key ]=new HtmlSemDoubleElement ($ key ."- " .$ this ->identifier ,"div " ,$ baseClass );
41+ }
42+ return $ this ->content [$ key ];
43+ }
44+
45+ private function _getRightContent (){
46+ return $ this ->_getContent ("right-content " ,"right floated content " );
47+ }
48+
49+ public function addContent ($ content ,$ before =false ){
50+ $ this ->_getContent ("content " )->addContent ($ content ,$ before );
51+ return $ this ;
52+ }
53+
54+ public function addRightContent ($ content ,$ before =false ){
55+ $ this ->_getRightContent ()->addContent ($ content ,$ before );
56+ return $ this ;
4157 }
4258
4359 public function setTitle ($ title ,$ description =NULL ,$ baseClass ="title " ){
4460 $ title =new HtmlSemDoubleElement ("" ,"div " ,$ baseClass ,$ title );
45- if (\array_key_exists ("content " , $ this ->content )===false ){
46- $ this ->createContent ();
47- }
48- $ this ->content ["content " ]->addContent ($ title );
61+ $ content =$ this ->_getContent ();
62+ $ content ->addContent ($ title );
4963 if (isset ($ description )){
5064 $ description =new HtmlSemDoubleElement ("" ,"div " ,"description " ,$ description );
51- $ this -> content [ " content " ] ->addContent ($ description );
65+ $ content ->addContent ($ description );
5266 }
5367 return $ this ;
5468 }
5569
5670 public function getPart ($ partName ="header " ){
57- $ content =\array_merge ($ this ->content [ " content " ] ->getContent (),array (@$ this ->content ["icon " ],@$ this ->content ["image " ]));
71+ $ content =\array_merge ($ this ->_getContent () ->getContent (),array (@$ this ->content ["icon " ],@$ this ->content ["image " ]));
5872 return $ this ->getElementByPropertyValue ("class " , $ partName , $ content );
5973 }
6074
@@ -84,7 +98,7 @@ public function asLink($href=NULL,$part=NULL){
8498 */
8599 public function compile (JsUtils $ js =NULL , &$ view =NULL ) {
86100 if (\is_array ($ this ->content ) && JArray::isAssociative ($ this ->content ))
87- $ this ->content =JArray::sortAssociative ($ this ->content , [ "icon " ,"image " ,"content " ]);
101+ $ this ->content =JArray::sortAssociative ($ this ->content , [ "right-content " , " icon " ,"image " ,"content " ]);
88102 return parent ::compile ($ js , $ view );
89103 }
90104}
0 commit comments