widgets/Comment.php
public function init()
    {
        parent::init();

        if (empty($this->model)) {
            throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "model" property must be set.'));
        }

        if (empty($this->pjaxContainerId)) {
            $this->pjaxContainerId = 'comment-pjax-container-' . $this->getId();
        }

        if (empty($this->model->{$this->entityIdAttribute})) {
            throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "entityIdAttribute" value for widget model cannot be empty.'));
        }

        $this->entity = hash('crc32', get_class($this->model));
        $this->entityId = $this->model->{$this->entityIdAttribute};

        if (empty($this->relatedTo)) {
            $this->relatedTo = get_class($this->model) . ':' . $this->entityId;
        }

        $this->encryptedEntity = $this->getEncryptedEntity();
        $this->commentWrapperId = $this->entity . $this->entityId;

        $this->registerAssets();
    }
public function init()
    {
        parent::init();

        if (empty($this->model)) {
            throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "model" property must be set.'));
        }

        if (empty($this->pjaxContainerId)) {
            $this->pjaxContainerId = 'comment-pjax-container-' . $this->getId();
        }

        if (empty($this->model->{$this->entityIdAttribute})) {
            throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "entityIdAttribute" value for widget model cannot be empty.'));
        }

        $this->entity = hash('crc32', get_class($this->model));
        $this->entityId = $this->model->{$this->entityIdAttribute};

        if (empty($this->relatedTo)) {
            $this->relatedTo = get_class($this->model) . ':' . $this->entityId;
        }

        $this->encryptedEntity = $this->getEncryptedEntity();
        $this->commentWrapperId = $this->entity . $this->entityId;

        $this->registerAssets();
    }
public function init ( ) { parent :: init ( ) ; if ( empty ( $ this -> model ) ) { throw new InvalidConfigException ( Yii :: t ( 'yii2mod.comments' , 'The "model" property must be set.' ) ) ; } if ( empty ( $ this -> pjaxContainerId ) ) { $ this -> pjaxContainerId = 'comment-pjax-container-' . $ this -> getId ( ) ; } if ( empty ( $ this -> model -> { $ this -> entityIdAttribute } ) ) { throw new InvalidConfigException ( Yii :: t ( 'yii2mod.comments' , 'The "entityIdAttribute" value for widget model cannot be empty.' ) ) ; } $ this -> entity = hash ( 'crc32' , get_class ( $ this -> model ) ) ; $ this -> entityId = $ this -> model -> { $ this -> entityIdAttribute } ; if ( empty ( $ this -> relatedTo ) ) { $ this -> relatedTo = get_class ( $ this -> model ) . ':' . $ this -> entityId ; } $ this -> encryptedEntity = $ this -> getEncryptedEntity ( ) ; $ this -> commentWrapperId = $ this -> entity . $ this -> entityId ; $ this -> registerAssets ( ) ; }
Initializes the widget params.
Initializes the widget params .