vendor/2amigos/yii2-date-time-picker-widget/tests/functional/data/overrides/TestDateTimePicker.php
/**
     * Registers required script for the plugin to work as a DateTimePicker
     */
Registers required script for the plugin to work as a DateTimePicker
Registers required script for the plugin to work as a DateTimePicker
public function registerClientScript()
    {
        $view = $this->getView();
        if ($this->language !== null) {
            $this->clientOptions['language'] = $this->language;
            DateTimePickerAsset::register(
                $view
            )->js[] = 'js/locales/bootstrap-datetimepicker.' . $this->language . '.js';
        } else {
            DateTimePickerAsset::register($view);
        }
        $id = $this->options['id'];
        $selector = ";jQuery('#$id')";
        if (strpos($this->template, '{button}') !== false || $this->inline) {
            $selector .= ".parent()";
        }
        $options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '';
        $js[] = "$selector.datetimepicker($options);";
        if ($this->inline) {
            $js[] = "$selector.find('.datetimepicker-inline').addClass('center-block');";
            $js[] = "$selector.find('table.table-condensed').attr('align','center').css('margin','auto');";
        }
        if (!empty($this->clientEvents)) {
            foreach ($this->clientEvents as $event => $handler) {
                $js[] = "$selector.on('$event', $handler);";
            }
        }
        $view->registerJs(implode("\n", $js), View::POS_READY, 'test-datetimepicker-js');
    }
public function registerClientScript ( ) { $ view = $ this -> getView ( ) ; if ( $ this -> language !== null ) { $ this -> clientOptions [ 'language' ] = $ this -> language ; DateTimePickerAsset :: register ( $ view ) -> js [ ] = 'js/locales/bootstrap-datetimepicker.' . $ this -> language . '.js' ; } else { DateTimePickerAsset :: register ( $ view ) ; } $ id = $ this -> options [ 'id' ] ; $ selector = " ;jQuery('# $ id ') " ; if ( strpos ( $ this -> template , '{button}' ) !== false || $ this -> inline ) { $ selector .= " .parent() " ; } $ options = ! empty ( $ this -> clientOptions ) ? Json :: encode ( $ this -> clientOptions ) : '' ; $ js [ ] = " $ selector .datetimepicker( $ options ); " ; if ( $ this -> inline ) { $ js [ ] = " $ selector .find('.datetimepicker-inline').addClass('center-block'); " ; $ js [ ] = " $ selector .find('table.table-condensed').attr('align','center').css('margin','auto'); " ; } if ( ! empty ( $ this -> clientEvents ) ) { foreach ( $ this -> clientEvents as $ event => $ handler ) { $ js [ ] = " $ selector .on(' $ event ',  $ handler ); " ; } } $ view -> registerJs ( implode ( " \n " , $ js ) , View :: POS_READY , 'test-datetimepicker-js' ) ; }
Registers required script for the plugin to work as a DateTimePicker
Registers required script for the plugin to work as a DateTimePicker