yii\base\Widget::getId PHP Method

getId() public method

Returns the ID of the widget.
public getId ( boolean $autoGenerate = true ) : string
$autoGenerate boolean whether to generate an ID if it is not set previously
return string ID of the widget.
    public function getId($autoGenerate = true)
    {
        if ($autoGenerate && $this->_id === null) {
            $this->_id = static::$autoIdPrefix . static::$counter++;
        }
        return $this->_id;
    }