Your IP : 216.73.216.240


Current Path : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Sky/
Upload File :
Current File : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Sky/Hero.php

<?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 Hero extends Bootstrap
{
    public function display()
    {
        // $data - title, subtitle, description, url, secondary_url
        // $config - button_class, button_text, title_class, subtitle_class, desc_class
        
        $item = (array) $this->data;

        $output = '';

        if (isset($item['subtitle']) && $item['subtitle'])
        {
            $output .= $this->html->div($item['subtitle'], array('class' => $this->config['subtitle_class']));
        }

        if (isset($item['title']) && $item['title'])
        {
            $output .= $this->html->heading($item['title'], array('class' => $this->config['title_class']), 'h1');
        }
        
        if (isset($item['description']) && $item['description'])
        {
            $output .= $this->html->div($item['description'], array('class' => $this->config['desc_class']));
        }
        
        if (isset($item['url']) && $item['url'])
        {
            $button = array(
                'url' => $item['url'],
                'title' => $this->config['button_text'],
                'icon' => $this->config['button_icon'] ?? '',
            );

            $btn = new Button($button, array('button_class' => $this->config['button_class']));

            $output .= $btn->display();
        }

        if (isset($item['secondary_url']) && $item['secondary_url'])
        {
            $button2 = array(
                'url' => $item['secondary_url'],
                'title' => $this->config['button2_text'],
                'icon' => $this->config['button2_icon'],
            );
            
            $btn2 = new Button($button2, array('button_class' => $this->config['button2_class']));

            $output .= $btn2->display();
        }
        
        return $output;
    }
}