[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/editors/tinymce/src/PluginTraits/ -> ActiveSiteTemplate.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Editors.tinymce
   6   *
   7   * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Plugin\Editors\TinyMCE\PluginTraits;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use RuntimeException;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Gets the active Site template style.
  23   *
  24   * @since  4.1.0
  25   */
  26  trait ActiveSiteTemplate
  27  {
  28      /**
  29       * Helper function to get the active Site template style.
  30       *
  31       * @return  object
  32       *
  33       * @since   4.1.0
  34       */
  35      protected function getActiveSiteTemplate()
  36      {
  37          $db    = Factory::getContainer()->get('db');
  38          $query = $db->getQuery(true)
  39              ->select('*')
  40              ->from($db->quoteName('#__template_styles'))
  41              ->where(
  42                  [
  43                      $db->quoteName('client_id') . ' = 0',
  44                      $db->quoteName('home') . ' = ' . $db->quote('1'),
  45                  ]
  46              );
  47  
  48          $db->setQuery($query);
  49  
  50          try {
  51              return $db->loadObject();
  52          } catch (RuntimeException $e) {
  53              $this->app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
  54  
  55              return new \stdClass();
  56          }
  57      }
  58  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer