/** * Attempt to get the option list from the model * * The model needs to be set and have a method with the following convention: * * attribute -> get[Attribute]Options, i.e.: * user_id -> getUserIdOptions() * * Otherwise it will return an empty array * * @param $name * * @return mixed */ protected function getOptionsFromModel($name) { $model = $this->form->getModel(); if (is_null($model)) { return array(); } $method = 'get' . String::studly($name) . 'Options'; if (method_exists($model, $method)) { return $model->{$method}(); } return array(); }