CoreFiles by mySites.guru
DownloadModel.php87 lines, 2,271 bytes, from Joomla_6.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 6.2.0-beta2
md5
e7b98a90b1e0a4d3a56f3dcd951d91db
sha1
407f9efcedcb604f6618455e50e2947c83cfff30
sha256
a059480207c07f4360d9a29e856e8c047e485ec89d2fde1b2e755e53f716c327
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_banners
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Banners\Administrator\Model;

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\MVC\Model\FormModel;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Download model.
 *
 * @since  1.5
 */
class DownloadModel extends FormModel
{
    /**
     * The model context
     *
     * @var  string
     */
    protected $_context = 'com_banners.tracks';

    /**
     * Auto-populate the model state.
     *
     * Note. Calling getState in this method will result in recursion.
     *
     * @return  void
     *
     * @since   1.6
     */
    protected function populateState()
    {
        $input = Factory::getApplication()->getInput();

        $this->setState('basename', $input->cookie->getString(ApplicationHelper::getHash($this->_context . '.basename'), '__SITE__'));
        $this->setState('compressed', $input->cookie->getInt(ApplicationHelper::getHash($this->_context . '.compressed'), 1));
    }

    /**
     * Method to get the record form.
     *
     * @param   array    $data      Data for the form.
     * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
     *
     * @return  Form  A Form object
     *
     * @since   1.6
     * @throws  \Exception on failure
     */
    public function getForm($data = [], $loadData = true)
    {
        return $this->loadForm('com_banners.download', 'download', ['control' => 'jform', 'load_data' => $loadData]);
    }

    /**
     * Method to get the data that should be injected in the form.
     *
     * @return  mixed  The data for the form.
     *
     * @since   1.6
     */
    protected function loadFormData()
    {
        $data = (object) [
            'basename'   => $this->getState('basename'),
            'compressed' => $this->getState('compressed'),
        ];

        $this->preprocessData('com_banners.download', $data);

        return $data;
    }
}

The same content is in 30 releases, Joomla 6.1.0-alpha2 to 6.2.1-rc1. See them all, or every version of this file.