[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_templates 6 * 7 * @copyright (C) 2008 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\Component\Templates\Administrator\View\Templates; 12 13 use Joomla\CMS\Component\ComponentHelper; 14 use Joomla\CMS\Helper\ContentHelper; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\MVC\View\GenericDataException; 17 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 18 use Joomla\CMS\Plugin\PluginHelper; 19 use Joomla\CMS\Toolbar\ToolbarHelper; 20 21 // phpcs:disable PSR1.Files.SideEffects 22 \defined('_JEXEC') or die; 23 // phpcs:enable PSR1.Files.SideEffects 24 25 /** 26 * View class for a list of template styles. 27 * 28 * @since 1.6 29 */ 30 class HtmlView extends BaseHtmlView 31 { 32 /** 33 * The list of templates 34 * 35 * @var array 36 * @since 1.6 37 */ 38 protected $items; 39 40 /** 41 * The pagination object 42 * 43 * @var object 44 * @since 1.6 45 */ 46 protected $pagination; 47 48 /** 49 * The model state 50 * 51 * @var object 52 * @since 1.6 53 */ 54 protected $state; 55 56 /** 57 * @var string 58 * @since 3.2 59 */ 60 protected $file; 61 62 /** 63 * Form object for search filters 64 * 65 * @var \Joomla\CMS\Form\Form 66 * 67 * @since 4.0.0 68 */ 69 public $filterForm; 70 71 /** 72 * The active search filters 73 * 74 * @var array 75 * @since 4.0.0 76 */ 77 public $activeFilters; 78 79 /** 80 * Is the parameter enabled to show template positions in the frontend? 81 * 82 * @var boolean 83 * @since 4.0.0 84 */ 85 public $preview; 86 87 /** 88 * The state of installer override plugin. 89 * 90 * @var array 91 * 92 * @since 4.0.0 93 */ 94 protected $pluginState; 95 96 /** 97 * Execute and display a template script. 98 * 99 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 100 * 101 * @return void 102 * 103 * @since 1.6 104 */ 105 public function display($tpl = null) 106 { 107 $this->items = $this->get('Items'); 108 $this->pagination = $this->get('Pagination'); 109 $this->state = $this->get('State'); 110 $this->total = $this->get('Total'); 111 $this->filterForm = $this->get('FilterForm'); 112 $this->activeFilters = $this->get('ActiveFilters'); 113 $this->preview = ComponentHelper::getParams('com_templates')->get('template_positions_display'); 114 $this->file = base64_encode('home'); 115 $this->pluginState = PluginHelper::isEnabled('installer', 'override'); 116 117 // Check for errors. 118 if (count($errors = $this->get('Errors'))) { 119 throw new GenericDataException(implode("\n", $errors), 500); 120 } 121 122 $this->addToolbar(); 123 124 parent::display($tpl); 125 } 126 127 /** 128 * Add the page title and toolbar. 129 * 130 * @return void 131 * 132 * @since 1.6 133 */ 134 protected function addToolbar() 135 { 136 $canDo = ContentHelper::getActions('com_templates'); 137 $clientId = (int) $this->get('State')->get('client_id'); 138 139 // Add a shortcut to the styles list view. 140 ToolbarHelper::link('index.php?option=com_templates&view=styles&client_id=' . $clientId, 'COM_TEMPLATES_MANAGER_STYLES_BUTTON', 'brush thememanager'); 141 142 // Set the title. 143 if ($clientId === 1) { 144 ToolbarHelper::title(Text::_('COM_TEMPLATES_MANAGER_TEMPLATES_ADMIN'), 'icon-code thememanager'); 145 } else { 146 ToolbarHelper::title(Text::_('COM_TEMPLATES_MANAGER_TEMPLATES_SITE'), 'icon-code thememanager'); 147 } 148 149 if ($canDo->get('core.admin') || $canDo->get('core.options')) { 150 ToolbarHelper::preferences('com_templates'); 151 ToolbarHelper::divider(); 152 } 153 154 ToolbarHelper::help('Templates:_Templates'); 155 } 156 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |