예제 #1
0
 /**
  * @inheritdoc
  */
 public function registerClientScript()
 {
     $view = $this->getView();
     GalleryAsset::register($view);
     DosamigosAsset::register($view);
     $id = $this->options['id'];
     $options = Json::encode($this->clientOptions);
     $items = $this->json ? Json::encode($this->items) : "\$('#{$id}').find('a.gallery-item').hide()";
     $js = "blueimp.Gallery({$items}, {$options});";
     $view->registerJs($js);
 }
예제 #2
0
 /**
  * Registers the client script required for the plugin
  */
 public function registerClientScript()
 {
     $view = $this->getView();
     GalleryAsset::register($view);
     DosamigosAsset::register($view);
     $id = $this->options['id'];
     $options = Json::encode($this->clientOptions);
     $js = "dosamigos.gallery.registerLightBoxHandlers('#{$id} a', {$options});";
     $view->registerJs($js);
     if (!empty($this->clientEvents)) {
         $js = [];
         foreach ($this->clientEvents as $event => $handler) {
             $js[] = "jQuery('{$id}').on('{$event}', {$handler});";
         }
         $view->registerJs(implode("\n", $js));
     }
 }