ContentPrepareEvent
扩展 ContentEvent内容事件的类。
示例:new ContentPrepareEvent('onEventName', ['context' => 'com_example.example', 'subject' => $contentObject, 'params' => $params, 'page' => $pageNum]);
| 自 |
5.0.0 |
|---|---|
| 包 |
Joomla CMS |
方法
__construct
构造函数。
__construct( name, mixed||string|int arguments = []) :
| 抛出 |
|
|---|---|
| 自 |
5.0.0 |
参数
- name
string事件名称。- arguments
array<string|int, mixed>事件参数。
响应
mixed
create
为给定的事件名称和主题创建一个新的 CMS 事件对象。必须提供以下参数:主题对象事件的主题。这是您要操作的核心对象。
create( eventName, mixed||string|int arguments = []) :
eventClass string 事件类名称。如果您没有提供它,将使用 Joomla\CMS\Events<eventNameWithoutOnPrefix>。
| 自 |
4.0.0 |
|---|---|
| 抛出 |
|
参数
- eventName
string事件名称,例如 onTableBeforeLoad- arguments
array<string|int, mixed>传递给事件的额外参数
响应
静态的
getArgument
获取事件参数值。
getArgument( name, default = null) :
如果存在,它将使用预处理方法。该方法的签名为
onGet<ArgumentName>($value): mixed
其中
$value 是当前存储在事件的 $arguments 数组中的值 它返回要返回给调用者的值。
| 自 |
4.0.0 |
|---|
参数
- name
string参数名称。- default
mixed如果未找到,则为默认值。
响应
mixed参数值或默认值。
getContext
上下文参数的 Getter。
getContext() :
| 自 |
5.0.0 |
|---|
响应
string
getEventClassByEventName
获取给定事件名称的具体事件类名称。
getEventClassByEventName( eventName) :
如果此特性的事件名称未知,此方法将回退到通用的 Joomla\Event\Event 类。
| 自 |
4.2.0 |
|---|
参数
- eventName
string事件名称
响应
string事件类名称
getItem
项目参数的 Getter。
getItem() :
| 自 |
5.0.0 |
|---|
响应
object
getPage
页面参数的 Getter。
getPage() : int
| 自 |
5.0.0 |
|---|
响应
int|null
getParams
项目参数的 Getter。
getParams() : \Joomla\Registry\Registry
| 自 |
5.0.0 |
|---|
响应
Registry
offsetSet
设置事件参数的值。
offsetSet( name, value) :
| 自 |
4.0.0 |
|---|---|
| 抛出 |
|
参数
- name
string参数名称。- value
mixed参数值。
响应
void
offsetUnset
删除事件参数。
offsetUnset( name) :
| 自 |
4.0.0 |
|---|---|
| 抛出 |
|
参数
- name
string参数名称。
响应
void
onSetContext
上下文参数的 Setter。
onSetContext( value) :
| 自 |
5.0.0 |
|---|
参数
- value
string要设置的值
响应
string
onSetPage
页面参数的 Setter。
onSetPage(int value) : int
| 自 |
5.0.0 |
|---|
参数
- value
int|null要设置的值
响应
int|null
onSetParams
params 参数的 Setter。
onSetParams(\Joomla\Registry\Registry value) : \Joomla\Registry\Registry
| 自 |
5.0.0 |
|---|
参数
- value
Registry要设置的值
响应
Registry
onSetSubject
主题参数的 Setter。
onSetSubject( value) :
| 自 |
5.0.0 |
|---|
参数
- value
object要设置的值
响应
object
reshapeArguments
重塑参数数组以保留与传统侦听器的 b/c
reshapeArguments(mixed||string|int arguments, mixed||string|int argumentNames, mixed||string|int defaults = []) : mixed||string|int
| 自 |
4.2.0 |
|---|
参数
- arguments
array<string|int, mixed>传递给构造函数的命名参数数组。- argumentNames
array<string|int, mixed>允许的参数名称(强制性和可选的)。- defaults
array<string|int, mixed>可选参数的默认值。
响应
array<string|int, mixed>重塑的参数。
setArgument
将参数添加到事件。
setArgument( name, value) :
如果存在,它将使用预处理方法。该方法的签名为
onSet<ArgumentName>($value): mixed
其中
$value 是用户正在设置的值 它返回要返回以设置在事件的 $arguments 数组中的值。
| 自 |
4.0.0 |
|---|
参数
- name
string参数名称。- value
mixed值。
响应
$this
属性
eventNameToConcreteClass
将事件名称映射到具体的事件类。
这仅适用于事件名称不变的事件。事件名称可变的事件在 getEventClassByEventName 类中使用 PHP 逻辑进行处理。
| 自 |
4.2.0 |
|---|
类型
array<string|int, mixed>
constructed
一个标志,用于查看构造函数是否已被调用。
| 自 |
4.0.0 |
|---|
类型
bool
legacyArgumentsOrder
参数名称,按传统插件期望的顺序。
| 自 |
5.0.0 |
|---|---|
| 已弃用 |
5.0 将在 6.0 中删除 |
类型
array<string|int, mixed>