public function renderAttribute($fieldName, $makeLinks = true, $textOnly = true, $encode = true) { $field = $this->owner->getField($fieldName); if (!isset($field)) { return null; } if (!YII_UNIT_TESTING && Yii::app()->params->noSession) { $webRequestAttributes = array('rating', 'assignment', 'optionalAssignment', 'url', 'text'); if (in_array($field->type, $webRequestAttributes)) { return $this->render($this->owner->{$fieldName}, $encode); } } $renderByNameFn = 'render' . ucfirst($field->fieldName); $renderByTypeFn = 'render' . ucfirst($field->type); // first check for field-specific renderer. Exclude field names that match an existing // type if (method_exists($this, $renderByNameFn) && !in_array($field->fieldName, $this->getValidFieldTypes())) { return $this->{$renderByNameFn}($field, $makeLinks, $textOnly, $encode); } elseif (method_exists($this, $renderByTypeFn)) { return $this->{$renderByTypeFn}($field, $makeLinks, $textOnly, $encode); } else { return $this->render($this->owner->{$fieldName}, $encode); } }