CoreFiles by mySites.guru
ActiveSiteTemplate.php54 lines, 1,296 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
8b30e9bd0244e75d0593b56a3941e9c4
sha1
417b9c67074ac2fdea9b6cf3770fa1352550231e
sha256
1496b45d996a0f9c6e2664f5fd3536a65f678fd08843d4fc6760c7d276d0aba4
<?php

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

namespace Joomla\Plugin\Editors\TinyMCE\PluginTraits;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use RuntimeException;

/**
 * Gets the active Site template style.
 *
 * @since  4.1.0
 */
trait ActiveSiteTemplate
{
    /**
     * Helper function to get the active Site template style.
     *
     * @return  object
     *
     * @since   4.1.0
     */
    protected function getActiveSiteTemplate()
    {
        $db    = Factory::getContainer()->get('db');
        $query = $db->getQuery(true)
            ->select('*')
            ->from($db->quoteName('#__template_styles'))
            ->where(
                [
                    $db->quoteName('client_id') . ' = 0',
                    $db->quoteName('home') . ' = ' . $db->quote('1'),
                ]
            );

        $db->setQuery($query);

        try {
            return $db->loadObject();
        } catch (RuntimeException $e) {
            $this->app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');

            return new \stdClass();
        }
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.