/**
* Method to get data from a registered model or a property of the view
*
* @param string $property The name of the method to call on the model or the property to get
* @param string $default The name of the model to reference or the default value [optional]
*
* @return mixed The return value of the method
*
* @since 3.0
*/
public function get($property, $default = null)
{
// If $model is null we use the default model
if ($default === null) {
$model = $this->_defaultModel;
} else {
$model = strtolower($default);
}
// First check to make sure the model requested exists
if (isset($this->_models[$model])) {
// Model exists, let's build the method name
$method = 'get' . ucfirst($property);
// Does the method exist?
if (method_exists($this->_models[$model], $method)) {
// The method exists, let's call it and return what we get
return $this->_models[$model]->{$method}();
}
}
// Degrade to CMSObject::get
return parent::get($property, $default);
}