[ 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_redirect 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\Redirect\Administrator\View\Link; 12 13 use Joomla\CMS\Factory; 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 to edit a redirect link. 26 * 27 * @since 1.6 28 */ 29 class HtmlView extends BaseHtmlView 30 { 31 /** 32 * The active item 33 * 34 * @var object 35 */ 36 protected $item; 37 38 /** 39 * The Form object 40 * 41 * @var \Joomla\CMS\Form\Form 42 */ 43 protected $form; 44 45 /** 46 * The model state 47 * 48 * @var \Joomla\CMS\Object\CMSObject 49 */ 50 protected $state; 51 52 /** 53 * Display the view. 54 * 55 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 56 * 57 * @return mixed False if unsuccessful, otherwise void. 58 * 59 * @since 1.6 60 */ 61 public function display($tpl = null) 62 { 63 $this->form = $this->get('Form'); 64 $this->item = $this->get('Item'); 65 $this->state = $this->get('State'); 66 67 // Check for errors. 68 if (count($errors = $this->get('Errors'))) { 69 throw new GenericDataException(implode("\n", $errors), 500); 70 } 71 72 $this->addToolbar(); 73 parent::display($tpl); 74 } 75 76 /** 77 * Add the page title and toolbar. 78 * 79 * @return void 80 * 81 * @since 1.6 82 */ 83 protected function addToolbar() 84 { 85 Factory::getApplication()->input->set('hidemainmenu', true); 86 87 $isNew = ($this->item->id == 0); 88 $canDo = ContentHelper::getActions('com_redirect'); 89 90 ToolbarHelper::title($isNew ? Text::_('COM_REDIRECT_MANAGER_LINK_NEW') : Text::_('COM_REDIRECT_MANAGER_LINK_EDIT'), 'map-signs redirect'); 91 92 $toolbarButtons = []; 93 94 // If not checked out, can save the item. 95 if ($canDo->get('core.edit')) { 96 ToolbarHelper::apply('link.apply'); 97 $toolbarButtons[] = ['save', 'link.save']; 98 } 99 100 /** 101 * This component does not support Save as Copy due to uniqueness checks. 102 * While it can be done, it causes too much confusion if the user does 103 * not change the Old URL. 104 */ 105 if ($canDo->get('core.edit') && $canDo->get('core.create')) { 106 $toolbarButtons[] = ['save2new', 'link.save2new']; 107 } 108 109 ToolbarHelper::saveGroup( 110 $toolbarButtons, 111 'btn-success' 112 ); 113 114 if (empty($this->item->id)) { 115 ToolbarHelper::cancel('link.cancel'); 116 } else { 117 ToolbarHelper::cancel('link.cancel', 'JTOOLBAR_CLOSE'); 118 } 119 120 ToolbarHelper::help('Redirects:_New_or_Edit'); 121 } 122 }
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 |