protected function registerPlugin($name = '') {
    $view = $this->getView();
    
    //$id = $this->options['id'];
    
    if ($this->clientOptions !== false) {
      $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
      $js = "$(document).foundation({ '$name' : { $options } });";
      $view->registerJs($js);
    }
    
    if (!empty($this->clientFireMethods)) {
      $js = [];
      foreach ($this->clientFireMethods as $method) {
        $js[] = "$(document).foundation('$name', '$method');";
      }
      $view->registerJs(implode("\n", $js));
    }
  }