Exemple #1
0
 /**
  * Builds the Panel object
  *
  * @param mixed $content Panel's content.
  * @param array $options Panel's options.
  * @return ContentTag a ContentTag instance that represents a Panel object.
  */
 private function build_panel($content = null, $options = [])
 {
     !is_array($options) ? $options = [] : null;
     $body = $this->build_panel_body($content);
     $heading = $this->build_panel_heading($options);
     $footer = $this->build_panel_footer($options);
     if (isset($options['tag'])) {
         $tag = $options['tag'];
         unset($options['tag']);
     } else {
         $tag = 'div';
     }
     if (isset($options['context'])) {
         $context = $options['context'];
         unset($options['context']);
     } else {
         $context = null;
     }
     $this->append_class($options, $this->panel_class($context));
     $panel_string = new ContentTag($tag, $options, function () use($heading, $body, $footer) {
         return [$heading, $body, $footer];
     });
     if (!is_null(Base::get_panel_column_class())) {
         $panel_string = new ContentTag('div', $panel_string, ['class' => Base::get_panel_column_class()]);
     }
     return $panel_string;
 }