yii\base\Model::formName PHP Method

formName() public method

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.
See also: load()
public formName ( ) : string
return string the form name of this model class.
    public function formName()
    {
        $reflector = new ReflectionClass($this);
        return $reflector->getShortName();
    }

Usage Example

 /**
  * @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