public function formElementName(string $var_name = ''): string
    {
        $parts = $var_name // This is optional.
            ? preg_split('/(\[[^[\]]*\])/u', $var_name, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY)
            : []; // An empty value could occur either way.

        if (!$parts) {
            return $this->data_var;
        } elseif (mb_strpos($parts[0], '[') === 0) {
            return $this->data_var.implode($parts);
        }
        return $this->data_var.'['.$parts[0].']'.implode(array_slice($parts, 1));
    }
public function formElementName(string $var_name = ''): string
    {
        $parts = $var_name // This is optional.
            ? preg_split('/(\[[^[\]]*\])/u', $var_name, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY)
            : []; // An empty value could occur either way.

        if (!$parts) {
            return $this->data_var;
        } elseif (mb_strpos($parts[0], '[') === 0) {
            return $this->data_var.implode($parts);
        }
        return $this->data_var.'['.$parts[0].']'.implode(array_slice($parts, 1));
    }
public function formElementName ( string $ var_name = '' ) : string { $ parts = $ var_name // This is optional. ? preg_split ( '/(\[[^[\]]*\])/u' , $ var_name , - 1 , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ) : [ ] ; // An empty value could occur either way. if ( ! $ parts ) { return $ this -> data_var ; } elseif ( mb_strpos ( $ parts [ 0 ] , '[' ) === 0 ) { return $ this -> data_var . implode ( $ parts ) ; } return $ this -> data_var . '[' . $ parts [ 0 ] . ']' . implode ( array_slice ( $ parts , 1 ) ) ; }
Data form element name.

@since 160608 ReST utils.

@param string $var_name Data var name.

@return string Data form element name.
Data form element name .