CoreFiles by mySites.guru
JsonView.php74 lines, 1,390 bytes, from Joomla_4.0.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 3.10.0-alpha9
md5
c2a569d730f0602cf10b0f03c8246f87
sha1
d8ecb892a2db78dc9c059da5d5f6b558b58670c6
sha256
94d7fca007e567c366fde03236013eda8325d721cfef0b0e4c1bf79c209f0436
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_templates
 *
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
namespace Joomla\Component\Templates\Administrator\View\Style;

defined('_JEXEC') or die;

use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;

/**
 * View to edit a template style.
 *
 * @since  1.6
 */
class JsonView extends BaseHtmlView
{
	/**
	 * The \JObject (on success, false on failure)
	 *
	 * @var   \JObject
	 */
	protected $item;

	/**
	 * The form object
	 *
	 * @var   \JForm
	 */
	protected $form;

	/**
	 * The model state
	 *
	 * @var   \JObject
	 */
	protected $state;

	/**
	 * 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.
	 *
	 * @since   1.6
	 */
	public function display($tpl = null)
	{
		try
		{
			$this->item = $this->get('Item');
		}
		catch (\Exception $e)
		{
			$app = \JFactory::getApplication();
			$app->enqueueMessage($e->getMessage(), 'error');

			return false;
		}

		$paramsList = $this->item->getProperties();

		unset($paramsList['xml']);

		$paramsList = json_encode($paramsList);

		return $paramsList;
	}
}

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