CoreFiles by mySites.guru
ActiveSiteTemplate.php57 lines, 1,145 bytes, from Joomla_4.1.2-Stable-Full_Package.zip
Raw History Compare with 4.1.1
md5
1d58360a2fdd00c89a513a6eb516fb3e
sha1
d45489b9409d979adb408a36676ce214ff6fd9dd
sha256
83880617269b3f529a17b90eb940db132b091f2a6a256609cc9d9ae4a0d43098
<?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;

\defined('_JEXEC') or die();

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 21 releases, Joomla 4.1.0-rc1 to 4.2.0-beta2. See them all, or every version of this file.