Add before/after events for component::onRun

This commit is contained in:
Samuel Georges 2016-04-27 05:43:55 +10:00
parent 589f6d1551
commit a5acbc7bff

View File

@ -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.
*