original_string: protected function registerPlugin($name, $selector = null)
      {
          /** @var View $view */
          $view = $this->getView();
  
          MaterializePluginAsset::register($view);
  
          $id = $this->options['id'];
  
          if (is_null($selector)) {
              $selector = '#' . $id;
          }
  
          if ($this->clientOptions !== false) {
              $options = empty($this->clientOptions) ? '{}' : Json::htmlEncode($this->clientOptions);
  
              $js = "document.addEventListener('DOMContentLoaded', function() {M.$name.init(document.querySelectorAll('$selector'), $options);});";
              $view->registerJs($js, View::POS_END);
          }
  
          $this->registerClientEvents();
      }
code: protected function registerPlugin($name, $selector = null)
      {
          /** @var View $view */
          $view = $this->getView();
  
          MaterializePluginAsset::register($view);
  
          $id = $this->options['id'];
  
          if (is_null($selector)) {
              $selector = '#' . $id;
          }
  
          if ($this->clientOptions !== false) {
              $options = empty($this->clientOptions) ? '{}' : Json::htmlEncode($this->clientOptions);
  
              $js = "document.addEventListener('DOMContentLoaded', function() {M.$name.init(document.querySelectorAll('$selector'), $options);});";
              $view->registerJs($js, View::POS_END);
          }
  
          $this->registerClientEvents();
      }
code_tokens: protected function registerPlugin ( $ name , $ selector = null ) { /** @var View $view */ $ view = $ this -> getView ( ) ; MaterializePluginAsset :: register ( $ view ) ; $ id = $ this -> options [ 'id' ] ; if ( is_null ( $ selector ) ) { $ selector = '#' . $ id ; } if ( $ this -> clientOptions !== false ) { $ options = empty ( $ this -> clientOptions ) ? '{}' : Json :: htmlEncode ( $ this -> clientOptions ) ; $ js = "document.addEventListener('DOMContentLoaded', function() {M.$name.init(document.querySelectorAll('$selector'), $options);});" ; $ view -> registerJs ( $ js , View :: POS_END ) ; } $ this -> registerClientEvents ( ) ; }
docstring: Registers a specific Materialize plugin and the related events.
  @param string $name the name of the Materialize plugin
  @param string|null $selector the name of the selector the plugin shall be attached to
  @uses [yii\helper\BaseJson::encode()](http://www.yiiframework.com/doc-2.0/yii-helpers-basejson.html#encode()-detail)
  to encode the [[clientOptions]]
  @uses [[MaterializePluginAsset::register()]]
  @uses [[registerClientEvents()]]
docstring_tokens: Registers a specific Materialize plugin and the related events .