helpers\BaseHtml getAttributeName()

getAttributeName() public static method

Returns the real attribute name from the given attribute expression.

An attribute expression is an attribute name prefixed and/or suffixed with array indexes. It is mainly used in tabular data input and/or input of array type. Below are some examples:

  • [0]content is used in tabular data input to represent the "content" attribute for the first model in tabular input;
  • dates[0] represents the first array element of the "dates" attribute;
  • [0]dates[0] represents the first array element of the "dates" attribute for the first model in tabular input.

If $attribute has neither prefix nor suffix, it will be returned back without change.

public static string getAttributeName ( $attribute )
$attribute string

The attribute name or expression

return string

The attribute name without prefix and suffix.

throws yii\base\InvalidParamException

if the attribute name contains non-word characters.

doc_Yii
2016-10-30 17:05:07
Comments
Leave a Comment

Please login to continue.