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;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
class Date extends Bootstrap
{
public function display()
{
// $config - tag, class, icon, relative, format
if (empty($this->data))
{
return;
}
$relative = $this->config['relative'] ?? false;
$format = $this->config['format'] ?? 'DATE_FORMAT_LC3';
$date = Factory::getDate($this->data);
$tag_class = isset($this->config['class']) && $this->config['class'] ? $this->config['class'] : '';
$output = '';
if (isset($this->config['icon']) && $this->config['icon'])
{
$output .= '<i class="' . $this->config['icon'] . '"></i> ';
}
if (isset($this->config['relative']) && $this->config['relative'])
{
$output .= HTMLHelper::_('date.relative', $date);
}
else
{
$output .= HTMLHelper::_('date', $date, $format);
}
if (isset($this->config['tag']) && $this->config['tag'])
{
$output = $this->html->element($this->config['tag'], $output, array('class' => $tag_class));
}
return $output;
}
}