CoreFiles by mySites.guru
JsonView.php73 lines, 1,586 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
c598848f3f466d6e478c3c6e75a9a7f0
sha1
9c364043a3df450a7c79b19653b4bd475a99b02e
sha256
5e3bf501ebdd1ecd7f0157bd582647c02db4131f6c42ca3397d34f1220877227
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_templates
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Templates\Administrator\View\Style;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;

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

    /**
     * The form object
     *
     * @var  \Joomla\CMS\Form\Form
     */
    protected $form;

    /**
     * The model state
     *
     * @var   CMSObject
     */
    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 = Factory::getApplication();
            $app->enqueueMessage($e->getMessage(), 'error');

            return false;
        }

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

        unset($paramsList['xml']);

        $paramsList = json_encode($paramsList);

        return $paramsList;
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.