- md5
- 5edf9a71cc61dcee003f4d489e0f105b
- sha1
- 3f4487fc0728e38874ef8a832ac01d38d74075dc
- sha256
- 75b5ac975a675dda7101dfcbc25b677f81c3ac2c3782edef95a4ec135e4ea0de
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Config\Administrator\View\Component;
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;
/**
* View for the component configuration
*
* @since 3.2
*/
class HtmlView extends BaseHtmlView
{
/**
* The model state
*
* @var \Joomla\CMS\Object\CMSObject
* @since 3.2
*/
public $state;
/**
* The form object
*
* @var \Joomla\CMS\Form\Form
* @since 3.2
*/
public $form;
/**
* An object with the information for the component
*
* @var \Joomla\CMS\Component\ComponentRecord
* @since 3.2
*/
public $component;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @see \JViewLegacy::loadTemplate()
* @since 3.2
*/
public function display($tpl = null)
{
$form = null;
$component = null;
try
{
$component = $this->get('component');
if (!$component->enabled)
{
return false;
}
$form = $this->get('form');
$user = Factory::getUser();
}
catch (\Exception $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
return false;
}
$this->fieldsets = $form ? $form->getFieldsets() : null;
$this->formControl = $form ? $form->getFormControl() : null;
// Don't show permissions fieldset if not authorised.
if (!$user->authorise('core.admin', $component->option) && isset($this->fieldsets['permissions']))
{
unset($this->fieldsets['permissions']);
}
$this->form = &$form;
$this->component = &$component;
$this->components = ConfigHelper::getComponentsWithConfig();
$this->userIsSuperAdmin = $user->authorise('core.admin');
$this->currentComponent = Factory::getApplication()->input->get('component');
$this->return = Factory::getApplication()->input->get('return', '', 'base64');
$this->addToolbar();
return parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.2
*/
protected function addToolbar()
{
ToolbarHelper::title(Text::_($this->component->option . '_configuration'), 'sliders-h config');
ToolbarHelper::apply('component.apply');
ToolbarHelper::divider();
ToolbarHelper::save('component.save');
ToolbarHelper::divider();
ToolbarHelper::cancel('component.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::divider();
$helpUrl = $this->form->getData()->get('helpURL');
$helpKey = (string) $this->form->getXml()->config->help['key'];
$helpKey = $helpKey ?: 'JHELP_COMPONENTS_' . strtoupper($this->currentComponent) . '_OPTIONS';
ToolbarHelper::help($helpKey, (boolean) $helpUrl, null, $this->currentComponent);
}
}
No other release has this exact content. See every version of this file.