CoreFiles by mySites.guru
HtmlView.php116 lines, 2,743 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
48943a989bea68dff21646a9077c960c
sha1
a4d591d6f5229adac6eb9ce28dee7f0e1625cb9b
sha256
79ad70b6f0b6b4dd02f54f1c4e9ab6f749ddf2615bef7c14fc63a01281daf052
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2018 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\Toolbar\ToolbarHelper;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;

/**
 * View for the component configuration
 *
 * @since  3.2
 */
class HtmlView extends BaseHtmlView
{
	public $state;

	public $form;

	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 = \JFactory::getUser();
		}
		catch (\Exception $e)
		{
			\JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');

			return false;
		}

		// Bind the form to the data.
		if ($form && $component->params)
		{
			$form->bind($component->params);
		}

		$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 = \JFactory::getApplication()->input->get('component');
		$this->return = \JFactory::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(\JText::_($this->component->option . '_configuration'), 'equalizer config');
		ToolbarHelper::saveGroup(
			[
				['apply', 'component.apply'],
				['save', 'component.save']
			],
			'btn-success'
		);
		ToolbarHelper::divider();
		ToolbarHelper::cancel('component.cancel');
		ToolbarHelper::divider();
		ToolbarHelper::help('JHELP_COMPONENTS_' . $this->currentComponent . '_OPTIONS');
	}
}

No other release has this exact content. See every version of this file.