protected function elementName(string $var_name = ''): string
    {
        if ($this->action) {
            return $this->s::restActionFormElementName($var_name);
        } elseif ($this->cfg->Widget) {
            return $this->cfg->Widget->get_field_name($var_name);
        }
        $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->c::slugToVar($this->cfg->slug);
        } elseif (mb_strpos($parts[0], '[') === 0) {
            return $this->c::slugToVar($this->cfg->slug).implode($parts);
        }
        return $this->c::slugToVar($this->cfg->slug).'['.$parts[0].']'.implode(array_slice($parts, 1));
    }
protected function elementName(string $var_name = ''): string
    {
        if ($this->action) {
            return $this->s::restActionFormElementName($var_name);
        } elseif ($this->cfg->Widget) {
            return $this->cfg->Widget->get_field_name($var_name);
        }
        $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->c::slugToVar($this->cfg->slug);
        } elseif (mb_strpos($parts[0], '[') === 0) {
            return $this->c::slugToVar($this->cfg->slug).implode($parts);
        }
        return $this->c::slugToVar($this->cfg->slug).'['.$parts[0].']'.implode(array_slice($parts, 1));
    }
protected function elementName ( string $ var_name = '' ) : string { if ( $ this -> action ) { return $ this -> s :: restActionFormElementName ( $ var_name ) ; } elseif ( $ this -> cfg -> Widget ) { return $ this -> cfg -> Widget -> get_field_name ( $ var_name ) ; } $ 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 -> c :: slugToVar ( $ this -> cfg -> slug ) ; } elseif ( mb_strpos ( $ parts [ 0 ] , '[' ) === 0 ) { return $ this -> c :: slugToVar ( $ this -> cfg -> slug ) . implode ( $ parts ) ; } return $ this -> c :: slugToVar ( $ this -> cfg -> slug ) . '[' . $ parts [ 0 ] . ']' . implode ( array_slice ( $ parts , 1 ) ) ; }
Form element name.

@since 160723 Menu page utils.

@param string $var_name Var name.

@return string Form element name.
Form element name .