@@ -59,7 +59,9 @@ public function create($title = null, $options = []) {
5959
6060 $ res = $ this ->Html ->div ($ class , null , $ options );
6161 if (is_string ($ title ) && $ title ) {
62- $ res .= $ this ->_createHeader ($ title , []) ;
62+ $ res .= $ this ->_createHeader ($ title , [
63+ 'title ' => isset ($ options ['title ' ]) ? $ options ['title ' ] : true
64+ ]) ;
6365 if (!$ nobody ) {
6466 $ res .= $ this ->_startPart ('body ' );
6567 }
@@ -69,7 +71,7 @@ public function create($title = null, $options = []) {
6971
7072 /**
7173 *
72- * End a panel. If $title is not null, the ModalHelper ::footer functions
74+ * End a panel. If $title is not null, the PanelHelper ::footer functions
7375 * is called with $title and $options arguments.
7476 *
7577 * @param string|null $buttons
@@ -98,21 +100,21 @@ protected function _cleanCurrent () {
98100 }
99101
100102 protected function _createHeader ($ title , $ options = [], $ titleOptions = []) {
101- $ options += [
102- '_title ' => []
103- ];
104- if (empty ($ titleOptions ))
105- $ titleOptions = $ options ['_title ' ];
106- unset ($ options ['_title ' ]);
103+ if (empty ($ titleOptions )) {
104+ $ titleOptions = $ options ['title ' ] ;
105+ }
106+ unset ($ options ['title ' ]);
107+ if ($ titleOptions !== false ) {
108+ if (!is_array ($ titleOptions )) {
109+ $ titleOptions = [];
110+ }
111+ $ titleOptions = $ this ->addClass ($ titleOptions , 'panel-title ' );
112+ $ title = $ titleOptions ? $ this ->Html ->tag ('h3 ' , $ title , $ titleOptions ) : $ title ;
113+ }
107114 $ options = $ this ->addClass ($ options , 'panel-heading ' );
108115 $ class = $ options ['class ' ];
109116 unset ($ options ['class ' ]);
110- $ titleOptions = $ this ->addClass ($ titleOptions , 'panel-title ' );
111- return $ this ->_cleanCurrent ().$ this ->Html ->div ($ class ,
112- $ this ->Html ->tag ('h3 ' , $ title ,
113- $ titleOptions ),
114- $ options
115- ) ;
117+ return $ this ->_cleanCurrent ().$ this ->Html ->div ($ class , $ title , $ options );
116118 }
117119
118120 protected function _createBody ($ text , $ options = []) {
@@ -149,14 +151,17 @@ protected function _endPart () {
149151 * Create / Start the header. If $info is specified as a string, create and return the
150152 * whole header, otherwize only open the header.
151153 *
152- * @param array|string $info If string, use as the modal title, otherwize works as $options.
154+ * @param array|string $info If string, use as the panel title, otherwize works as $options.
153155 * @param array $options Options for the header div.
154156 *
155157 * Special option (if $info is string):
156158 * - close: Add the 'close' button in the header (default true).
157159 *
158160 **/
159161 public function header ($ info = null , $ options = []) {
162+ $ options += [
163+ 'title ' => true
164+ ];
160165 if (is_string ($ info )) {
161166 return $ this ->_createHeader ($ info , $ options ) ;
162167 }
@@ -196,8 +201,11 @@ protected function _isAssociativeArray ($array) {
196201 * @param array $options Options for the footer div.
197202 *
198203 **/
199- public function footer ($ text = "" , $ options = []) {
200- return $ this ->_createFooter ($ text , $ options ) ;
204+ public function footer ($ text = null , $ options = []) {
205+ if (is_string ($ text )) {
206+ return $ this ->_createFooter ($ text , $ options ) ;
207+ }
208+ return $ this ->_startPart ('footer ' , is_array ($ text ) ? $ text : $ options );
201209 }
202210
203211}
0 commit comments