/** * Generates code for active field by using the provider queue * * @param ColumnSchema $column * @param null $model * * @return mixed|string */ public function activeField($attribute, $model = null) { if ($model === null) { $model = $this->modelClass; } $code = $this->callProviderQueue(__FUNCTION__, $attribute, $model, $this); if ($code !== null) { Yii::trace("found provider for '{$attribute}'", __METHOD__); return $code; } else { $column = $this->getColumnByAttribute($attribute); if (!$column) { return null; } else { return parent::generateActiveField($attribute); } } }
/** * Generates code for active field by using the provider queue * * @param string $attribute * * @return string */ public function activeField(ColumnSchema $column, $model = null) { Yii::trace("Rendering activeField for '{$column->name}'", __METHOD__); if ($model === null) { $model = $this->modelClass; } $code = $this->callProviderQueue(__FUNCTION__, $column, $model); if ($code !== null) { return $code; } else { return parent::generateActiveField($column->name); } }
public function generateActiveField($attribute) { $tableSchema = $this->getTableSchema(); if ($tableSchema === false || !isset($tableSchema->columns[$attribute])) { return parent::generateActiveField($attribute); } $column = $tableSchema->columns[$attribute]; if ($this->isBoolean($column)) { return "\$form->field(\$model, '{$attribute}')->checkbox()"; } return parent::generateActiveField($attribute); }
/** * (non-PHPdoc) * @see \yii\gii\generators\crud\Generator::generateActiveField($attribute) */ public function generateActiveField($attribute) { return str_replace(' => ', '=>', parent::generateActiveField($attribute)); }