Skip to content

Commit

Permalink
Update DatePickerHtmlBuilder.php
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekk-hnm committed Jun 13, 2022
1 parent de09c6e commit daac332
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/app/n2nutil/jquery/datepicker/DatePickerHtmlBuilder.php
Expand Up @@ -11,9 +11,11 @@

class DatePickerHtmlBuilder {
private $view;
private $addCss;

public function __construct(HtmlView $view) {
public function __construct(HtmlView $view, $addCss = true) {
$this->view = $view;
$this->addCss = $addCss;
}

public function getDatePicker($dateStyle = DateTimeFormat::DEFAULT_DATE_STYLE, $timeStyle = null,
Expand All @@ -22,7 +24,7 @@ public function getDatePicker($dateStyle = DateTimeFormat::DEFAULT_DATE_STYLE, $
$locale = $this->view->getRequest()->getN2nLocale();
}
$attrs = $this->extendAttrs($attrs);
$this->requireScripts($attrs['id']);
$this->requireScripts();
return new HtmlElement('input', HtmlUtils::mergeAttrs((array) $attrs, DatePickerUtils::getDatePickerOptionsFactory(
$locale, $timeZone)->createDatePickerOptions(DatePickerUtils::determinePattern($locale, $dateStyle, $timeStyle,
$timeZone, $simpleFormat))->buildHtmlAttrs()));
Expand Down Expand Up @@ -54,6 +56,8 @@ private function requireScripts() {
$html->meta()->addLibrary(new JQueryLibrary(3));
$html->meta()->bodyEnd()->addJs('js/ajah.js', 'n2n\impl\web\ui');
$html->meta()->addJs('datepicker/js/datePicker.js', 'n2nutil\jquery', false, false, null, HtmlBuilderMeta::TARGET_BODY_END);
$html->meta()->addCss('datepicker/css/datePicker.css', 'screen', 'n2nutil\jquery');
if ($this->addCss) {
$html->meta()->addCss('datepicker/css/datePicker.css', 'screen', 'n2nutil\jquery');
}
}
}
}

0 comments on commit daac332

Please sign in to comment.