protected function registerMaterializePlugin($name)
    {
        $view = $this->getView();
        if ($this->materializeAsset) {
            MaterializeAsset::register($view);
        }
        if ($this->customAsset) {
            MaterializeCustomAsset::register($view);
        }

        $id = $this->options['id'];

        if ($this->clientOptions !== false && is_array($this->clientOptions)) {
            $options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions);
            $js = "Materialize.$name.apply(null, $options);";
            $view->registerJs($js);
        }

        $this->registerClientEvents();
    }