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/Alert.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;

// Alert box with icon and close button
class Alert extends Bootstrap
{
    public $class_options = array('alert_class');

    public function display()
    {
        // $config - type, dismiss, icon

        $type = $this->config['type'] ?? 'primary';
        
        $class = 'alert alert-' . $type . ' ' . $this->get_class();
        if (isset($this->config['dismiss']) && $this->config['dismiss'])
        {
            $class .= ' alert-dismissible fade show';
        }

        $this->html->open_div(array('class' => $class, 'role' => 'alert'));

        if (isset($this->config['icon']) && $this->config['icon'])
        {
            $this->html->span('', array('class' => $this->config['icon'], 'aria-hidden' => 'true'));
            $this->html->add_content(' ');
        }
        
        $this->html->add_content($this->data);

        if (isset($this->config['dismiss']) && $this->config['dismiss'])
        {
            $this->html->button('', array('type' => 'button', 'class' => 'btn-close', 'data-bs-dismiss' => 'alert', 'aria-label' => 'Close'));
            
            $this->include_bsjs('alert');
        }

        $this->html->close_div();

        return $this->html->get_output();
    }
}