mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Add before/after events for component::onRun
This commit is contained in:
parent
589f6d1551
commit
a5acbc7bff
@ -163,9 +163,17 @@ class CmsCompoundObject extends CmsObject
|
||||
public function runComponents()
|
||||
{
|
||||
foreach ($this->components as $component) {
|
||||
if ($event = $component->fireEvent('component.beforeRun', [], true)) {
|
||||
return $event;
|
||||
}
|
||||
|
||||
if ($result = $component->onRun()) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ($event = $component->fireEvent('component.run', [], true)) {
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,6 +437,22 @@ class CmsCompoundObject extends CmsObject
|
||||
return parent::__get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically set attributes on the model.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
parent::__set($key, $value);
|
||||
|
||||
if (array_key_exists($key, $this->settings)) {
|
||||
$this->settings[$key] = $this->attributes[$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an attribute exists on the object.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user