[ 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) 2009 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\Styles; 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\Toolbar\ToolbarHelper; 19 20 // phpcs:disable PSR1.Files.SideEffects 21 \defined('_JEXEC') or die; 22 // phpcs:enable PSR1.Files.SideEffects 23 24 /** 25 * View class for a list of template styles. 26 * 27 * @since 1.6 28 */ 29 class HtmlView extends BaseHtmlView 30 { 31 /** 32 * An array of items 33 * 34 * @var array 35 */ 36 protected $items; 37 38 /** 39 * The pagination object 40 * 41 * @var \Joomla\CMS\Pagination\Pagination 42 */ 43 protected $pagination; 44 45 /** 46 * The model state 47 * 48 * @var \Joomla\CMS\Object\CMSObject 49 */ 50 protected $state; 51 52 /** 53 * Form object for search filters 54 * 55 * @var \Joomla\CMS\Form\Form 56 * 57 * @since 4.0.0 58 */ 59 public $filterForm; 60 61 /** 62 * The active search filters 63 * 64 * @var array 65 * @since 4.0.0 66 */ 67 public $activeFilters; 68 69 /** 70 * Is the parameter enabled to show template positions in the frontend? 71 * 72 * @var boolean 73 * @since 4.0.0 74 */ 75 public $preview; 76 77 /** 78 * Execute and display a template script. 79 * 80 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 81 * 82 * @return void 83 */ 84 public function display($tpl = null) 85 { 86 $this->items = $this->get('Items'); 87 $this->pagination = $this->get('Pagination'); 88 $this->state = $this->get('State'); 89 $this->total = $this->get('Total'); 90 $this->filterForm = $this->get('FilterForm'); 91 $this->activeFilters = $this->get('ActiveFilters'); 92 $this->preview = ComponentHelper::getParams('com_templates')->get('template_positions_display'); 93 94 // Remove the menu item filter for administrator styles. 95 if ((int) $this->state->get('client_id') !== 0) { 96 unset($this->activeFilters['menuitem']); 97 $this->filterForm->removeField('menuitem', 'filter'); 98 } 99 100 // Check for errors. 101 if (count($errors = $this->get('Errors'))) { 102 throw new GenericDataException(implode("\n", $errors), 500); 103 } 104 105 $this->addToolbar(); 106 107 parent::display($tpl); 108 } 109 110 /** 111 * Add the page title and toolbar. 112 * 113 * @return void 114 * 115 * @since 1.6 116 */ 117 protected function addToolbar() 118 { 119 $canDo = ContentHelper::getActions('com_templates'); 120 $clientId = (int) $this->get('State')->get('client_id'); 121 122 // Add a shortcut to the templates list view. 123 ToolbarHelper::link('index.php?option=com_templates&view=templates&client_id=' . $clientId, 'COM_TEMPLATES_MANAGER_TEMPLATES', 'icon-code thememanager'); 124 125 // Set the title. 126 if ($clientId === 1) { 127 ToolbarHelper::title(Text::_('COM_TEMPLATES_MANAGER_STYLES_ADMIN'), 'paint-brush thememanager'); 128 } else { 129 ToolbarHelper::title(Text::_('COM_TEMPLATES_MANAGER_STYLES_SITE'), 'paint-brush thememanager'); 130 } 131 132 if ($canDo->get('core.edit.state')) { 133 ToolbarHelper::makeDefault('styles.setDefault', 'COM_TEMPLATES_TOOLBAR_SET_HOME'); 134 ToolbarHelper::divider(); 135 } 136 137 if ($canDo->get('core.create')) { 138 ToolbarHelper::custom('styles.duplicate', 'copy', '', 'JTOOLBAR_DUPLICATE', true); 139 ToolbarHelper::divider(); 140 } 141 142 if ($canDo->get('core.delete')) { 143 ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'styles.delete', 'JTOOLBAR_DELETE'); 144 ToolbarHelper::divider(); 145 } 146 147 if ($canDo->get('core.admin') || $canDo->get('core.options')) { 148 ToolbarHelper::preferences('com_templates'); 149 ToolbarHelper::divider(); 150 } 151 152 ToolbarHelper::help('Templates:_Styles'); 153 } 154 }
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 |