Example #1
0
 /**
  * Render icon
  */
 private function _renderIcon()
 {
     if (!isset($this->parts['{icon}'])) {
         if (empty($this->icon)) {
             $this->parts['{icon}'] = '';
             return;
         }
         $options = $this->iconOptions;
         $position = ArrayHelper::remove($options, 'position', Html::ICON_APPEND);
         if (in_array($position, [Html::ICON_APPEND, Html::ICON_PREPEND])) {
             Html::addCssClass($options, $position);
         }
         $this->parts['{icon}'] = Html::icon($this->icon, $options);
     }
 }
Example #2
0
 public function testBeginEndIcon()
 {
     ob_start();
     $jarvis = Jarvis::begin(['id' => 'begin-end', 'icon' => 'its not print']);
     echo '<p>Body</p>';
     $jarvis->beginIcon();
     echo Html::icon(Html::ICON_FA_BELL_SLASH);
     $jarvis->endIcon();
     Jarvis::end();
     $content = ob_get_clean();
     $str = '<div id="begin-end" class="jarviswidget">' . '<header>' . '<span class="widget-icon"><i class="fa fa-bell-slash"></i></span>' . '</header>' . '<div>' . '<div class="widget-body"><p>Body</p></div>' . '</div>' . '</div>';
     $this->assertEquals($content, $str);
 }