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/Offcanvas.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 Offcanvas extends Bootstrap
{
    public $trigger;
    
    public $header;

    public $body;
    
    // Title, Body
    public function display()
    {
        // data - title, body
        // config - placement, trigger_icon_class

        $this->data = (array) $this->data;

        $output = '';

        $output .= $this->offcanvas_trigger();
        
        $output .= '<div class="offcanvas ' . $this->config['placement'] . '" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel">';
        
            $output .= $this->offcanvas_header();
            
            $output .= $this->offcanvas_body();
                
        $output .= '</div>';
        
        // Add Javascript and CSS
        $this->include_bsjs('offcanvas');
        $this->include_tfcss('offcanvas');

        return $output;
    }

    public function offcanvas_trigger()
    {
        $this->trigger = '<a class="" data-bs-toggle="offcanvas" href="#offcanvas" role="button" aria-controls="offcanvas">';
            $this->trigger .= '<i class="' . $this->config['trigger_icon_class'] . '"></i>';
        $this->trigger .= '</a>';

        return $this->trigger;
    }

    public function offcanvas_header()
    {
         $this->header = '<div class="offcanvas-header">';
            if (isset($this->data['title']) && $this->data['title'])
            {
                $this->header .= '<h5 class="offcanvas-title" id="offcanvasLabel">' . $this->data['title'] . '</h5>';
            }
            $this->header .= '<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>';
        $this->header .= '</div>';

        return $this->header;
    }

    public function offcanvas_body()
    {
        if (isset($this->data['body']) && $this->data['body'])
        {
            $this->body = '<div class="offcanvas-body">';

                $this->body .= $this->data['body'];

            $this->body .= '</div>';
        }

        return $this->body;
    }
}