Your IP : 216.73.216.240
<?php
/*
* @package Tech Fry Library
* @license https://www.gnu.org/licenses/gpl-3.0.en.html
*/
namespace TechFry\Library\View\Sky;
defined('_JEXEC') or die;
class Iconbox extends Cards
{
public $icon;
public $title;
public $desc;
public $output;
public $class_options = array('icon_class', 'size', 'color', 'rotate', 'animate');
public function display()
{
/*
item - icon, title, description, url
config - layout
icon - icon_class
title - title_head, title_class
desc - desc_class
url - button_class, button_text, button_icon
*/
$icon_class = $this->get_class();
foreach ($this->data as $k => $item)
{
$item = (array) $item;
$this->icon = '';
$this->icon .= '<div><i class="' . $item['icon'] . ' ' . $icon_class . '"></i></div>';
$this->get_title($item['title']);
$this->get_desc($item['description']);
$this->get_html();
if (is_object($this->data[$k]))
{
$this->data[$k]->html = $this->output;
unset($this->data[$k]->title);
unset($this->data[$k]->description);
}
elseif (is_array($this->data[$k]))
{
$this->data[$k]['html'] = $this->output;
unset($this->data[$k]['title']);
unset($this->data[$k]['description']);
}
}
return parent::display();
}
public function get_title($title)
{
$this->title = '';
if (!$title)
{
return;
}
$this->title = $this->html->heading($title, array('class' => $this->config['title_class']), $this->config['title_head']);
}
public function get_desc($desc)
{
$this->desc = '';
if (!$desc)
{
return;
}
$this->desc = $this->html->p($desc, array('class' => $this->config['desc_class']));
}
// Get Card Html based on Layout
public function get_html()
{
$this->output = '';
switch ($this->config['layout'])
{
case 1 : // Icon Above Title
$this->output .= $this->icon . $this->title . $this->desc;
break;
case 2 : // Icon Below Title
$this->output .= $this->title . $this->icon . $this->desc;
break;
case 3 : // Icon Left
$this->output .= '<div class="d-flex">';
$this->output .= $this->icon;
$this->output .= '<div>';
$this->output .= $this->title . $this->desc;
$this->output .= '</div>';
$this->output .= '</div>';
break;
}
}
}