yii\base\Model::formName PHP 메소드

formName() 공개 메소드

The form name is mainly used by ActiveForm to determine how to name the input fields for the attributes in a model. If the form name is "A" and an attribute name is "b", then the corresponding input name would be "A[b]". If the form name is an empty string, then the input name would be "b". The purpose of the above naming schema is that for forms which contain multiple different models, the attributes of each model are grouped in sub-arrays of the POST-data and it is easier to differentiate between them. By default, this method returns the model class name (without the namespace part) as the form name. You may override it when the model is used in different forms.
또한 보기: load()
public formName ( ) : string
리턴 string the form name of this model class.
    public function formName()
    {
        $reflector = new ReflectionClass($this);
        return $reflector->getShortName();
    }

Usage Example

예제 #1
3
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->header) {
         $this->header = "<h2>" . Inflector::camel2words($this->model->formName()) . " change log:</h2>";
     }
 }
All Usage Examples Of yii\base\Model::formName