CoreFiles by mySites.guru
HtmlView.php92 lines, 2,274 bytes, from Joomla_6.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 6.0.0-beta1
md5
9ac0a9c484bec62d9f70d70c61d3fa21
sha1
30e065919c70893d844175da3dda2b49a320764f
sha256
9c64285f6742356d720a839597dc421ad482aa67d4a698751efd899b29c7912f
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_banners
 *
 * @copyright   (C) 2008 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\View\Banners;

use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\MVC\View\ListView;
use Joomla\Component\Banners\Administrator\Model\BannersModel;

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

/**
 * View class for a list of banners.
 *
 * @since  1.6
 */
class HtmlView extends ListView
{
    /**
     * Category data
     *
     * @var    array
     * @since  1.6
     */
    protected $categories = [];

    /**
     * The help link for the view
     *
     * @var string
     */
    protected $helpLink = 'Banners';

    /**
     * Constructor
     *
     * @param   array  $config  An optional associative array of configuration settings.
     *
     * @since 6.0.0
     */
    public function __construct(array $config)
    {
        if (empty($config['option'])) {
            $config['option'] = 'com_banners';
        }

        $config['toolbar_icon']   = 'bookmark banners';
        $config['supports_batch'] = true;
        $config['category']       = 'com_banners';

        parent::__construct($config);
    }

    /**
     * Prepare view data
     *
     * @return  void
     *
     * @since 6.0.0
     */
    protected function initializeView()
    {
        parent::initializeView();

        /** @var BannersModel $model */
        $model            = $this->getModel();

        $this->categories = $model->getCategoryOrders();
        $this->canDo      = ContentHelper::getActions('com_banners', 'category', $this->state->get('filter.category_id'));

        // We do not need to filter by language when multilingual is disabled
        if (!Multilanguage::isEnabled()) {
            unset($this->activeFilters['language']);
            $this->filterForm->removeField('language', 'filter');
        }

        // Add form control fields
        $this->filterForm
            ->addControlField('task', '')
            ->addControlField('boxchecked', '0');
    }
}

The same content is in 2 releases, Joomla 6.0.0-beta2 to 6.0.0-beta3. See them all, or every version of this file.