/** * @param Parameter $parameter * @return array|Element[] */ public function headElements(Parameter $parameter) { $elements = [HeadElements::jquery(), HeadElements::jqueryUi(), HeadElements::jqueryUiCss()]; if ($this->mobile->isMobile()) { $elements[] = HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js'); } return $elements; }
/** * @param Parameter $parameter * @return array|Element[] */ public function headElements(Parameter $parameter) { return array_merge([HeadElements::jquery(), HeadElements::jqueryUi(), new Element('script', [], ["\$(function () {\n \$('.array-new-items').appendTo('body');\n \$('.array-items').sortable({handle:'.sortable-handle'});\n \$('.array-items .sortable-handle').disableSelection();\n });"])], $this->mobile->isMobile() ? [HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js')] : [], $this->itemHeadElements($this->makeInnerParameter($parameter))); }
function requireTouchPunchForMobile() { Mockster::stub($this->detector->isMobile())->will()->return_(true); $this->assert->contains($this->field->headElements(new Parameter('foo', new ArrayType(new UnknownType()))), HeadElements::script('//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js')); }