yii\base\Model::attributeLabels PHP Метод

attributeLabels() публичный Метод

Attribute labels are mainly used for display purpose. For example, given an attribute firstName, we can declare a label First Name which is more user-friendly and can be displayed to end users. By default an attribute label is generated using Model::generateAttributeLabel. This method allows you to explicitly specify attribute labels. Note, in order to inherit labels defined in the parent class, a child class needs to merge the parent labels with child labels using functions such as array_merge().
См. также: generateAttributeLabel()
public attributeLabels ( ) : array
Результат array attribute labels (name => label)
    public function attributeLabels()
    {
        return [];
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     $labels = parent::attributeLabels();
     $labels['name'] = Yii::t('app', 'Name');
     $labels['email'] = Yii::t('app', 'Email');
     $labels['subject'] = Yii::t('app', 'Subject');
     $labels['body'] = Yii::t('app', 'Body');
     $labels['verifyCode'] = Yii::t('app', 'Verification Code');
     return $labels;
 }
All Usage Examples Of yii\base\Model::attributeLabels