- md5
- eb6bf4731497fabc1fba9cc74285448e
- sha1
- 550e3fadee448e73e77f1a019c81952629d2c16d
- sha256
- a91e7132206ec8a51bb36e617582e1d3353d75cd2094d3339bfa7e0ebdb46a06
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?php
/**
* @package Joomla.API
* @subpackage com_privacy
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Privacy\Api\View\Requests;
use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;
use Joomla\CMS\Router\Exception\RouteNotFoundException;
use Joomla\CMS\Serializer\JoomlaSerializer;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Privacy\Administrator\Model\ExportModel;
use Tobscure\JsonApi\Resource;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* The requests view
*
* @since 4.0.0
*/
class JsonapiView extends BaseApiView
{
/**
* The fields to render item in the documents
*
* @var array
* @since 4.0.0
*/
protected $fieldsToRenderItem = ['id', 'typeAlias', 'email', 'requested_at', 'status', 'request_type'];
/**
* The fields to render items in the documents
*
* @var array
* @since 4.0.0
*/
protected $fieldsToRenderList = ['id', 'email', 'requested_at', 'status', 'request_type'];
/**
* Execute and display a template script.
*
* @return string
*
* @since 4.0.0
*/
public function export()
{
/** @var ExportModel $model */
$model = $this->getModel();
$exportData = $model->collectDataForExportRequest();
if ($exportData == false) {
throw new RouteNotFoundException('Item does not exist');
}
$serializer = new JoomlaSerializer('export');
$element = (new Resource($exportData, $serializer));
$this->document->setData($element);
$this->document->addLink('self', Uri::current());
return $this->document->render();
}
}
The same content is in 18 releases, Joomla 4.3.0-beta1 to 5.0.0-alpha1. See them all, or every version of this file.