Your IP : 216.73.216.240


Current Path : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/Model/
Upload File :
Current File : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/Model/TfModelImport.php

<?php
/*
* @package		Tech Fry Library
* @license		https://www.gnu.org/licenses/gpl-3.0.en.html
*/

namespace TechFry\Library\Model;

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormFactoryInterface;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Registry\Registry;
use Joomla\CMS\Form\Form;
use TechFry\Library\Model\Back\TfModelForm;

class TfModelImport extends TfModelForm
{
    public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?FormFactoryInterface $formFactory = null)
	{
	    parent::__construct($config, $factory, $formFactory);
	    
	    $this->basic_fields = [];
	    
	    $this->loadData = false;
	}
    
    public function getForm($data = [], $loadData = true)
    {
        $this->form = Form::getInstance($this->option . '.' . $this->getName(), JPATH_LIBRARIES . '/techfry/forms/' . $this->getName() . '.xml', array("control" => "jform"));
        
        if (empty($this->form))
        {
            return false;
        }
        
        // Get type (component.model) from Url
        $type = $this->input->get('type', '');
        if ($type)
        {
            $this->form->setFieldAttribute('type', 'default', $type);
            $this->form->setFieldAttribute('type', 'readonly', 'true');
        }
        
        return $this->form;
    }
}