| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function __construct(RawTqContext $context, $selector, $date) |
||
| 27 | { |
||
| 28 | $session = $context->getSession(); |
||
| 29 | |||
| 30 | if (empty($session->evaluateScript('jQuery.fn.datepicker'))) { |
||
| 31 | throw new \RuntimeException('jQuery DatePicker is not available on the page.'); |
||
| 32 | } |
||
| 33 | |||
| 34 | // Drupal 8 will use native "date" field if available. |
||
| 35 | $class = $session->evaluateScript('Modernizr && Modernizr.inputtypes.date') ? Native::class : JQuery::class; |
||
| 36 | |||
| 37 | self::debug(['The "%s" date picker will be used.'], [$class]); |
||
| 38 | |||
| 39 | $this->datePicker = new $class($context, $session, $context->element('*', $selector), $date); |
||
| 40 | } |
||
| 41 | |||
| 66 |