- md5
- 027d4151f84376bfb1afb9cd348ad9b8
- sha1
- aa75d00a4cf799c67f86075ee50e008d805fe697
- sha256
- a5916270ac40b20ff6125f5696fccd517b687384f3de6a68a6f3f76f4cb75475
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Event\Content;
use Joomla\Registry\Registry;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Class for Content event.
* Example:
* new ContentPrepareEvent('onEventName', ['context' => 'com_example.example', 'subject' => $contentObject, 'params' => $params, 'page' => $pageNum]);
*
* @since 5.0.0
*/
class ContentPrepareEvent extends ContentEvent
{
/**
* The argument names, in order expected by legacy plugins.
*
* @var array
*
* @since 5.0.0
* @deprecated 5.0 will be removed in 6.0
*/
protected $legacyArgumentsOrder = ['context', 'subject', 'params', 'page'];
/**
* Setter for the subject argument.
*
* @param object $value The value to set
*
* @return object
*
* @since 5.0.0
*/
protected function onSetSubject(object $value): object
{
return $value;
}
/**
* Setter for the params argument.
*
* @param Registry $value The value to set
*
* @return Registry
*
* @since 5.0.0
*/
protected function onSetParams($value): Registry
{
// This is for b/c compatibility, because some extensions pass a mixed types
if (!$value instanceof Registry) {
$value = new Registry($value);
// @TODO: In 6.0 throw an exception
@trigger_error(
\sprintf('The "params" attribute for the event "%s" must be type of Registry. In 6.0 it will throw an exception', $this->getName()),
E_USER_DEPRECATED
);
}
return $value;
}
/**
* Setter for the page argument.
*
* @param ?int $value The value to set
*
* @return ?int
*
* @since 5.0.0
*/
protected function onSetPage(?int $value): ?int
{
return $value;
}
/**
* Getter for the item argument.
*
* @return object
*
* @since 5.0.0
*/
public function getItem(): object
{
return $this->arguments['subject'];
}
/**
* Getter for the item argument.
*
* @return Registry
*
* @since 5.0.0
*/
public function getParams(): Registry
{
return $this->arguments['params'];
}
/**
* Getter for the page argument.
*
* @return ?int
*
* @since 5.0.0
*/
public function getPage(): ?int
{
return $this->arguments['page'];
}
}
The same content is in 39 releases, Joomla 5.2.0-beta3 to 6.0.0-alpha3. See them all, or every version of this file.