![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/View/Element/Html/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\View\Element\Html; /** * Date element block */ class Date extends \Magento\Framework\View\Element\Template { /** * Render block HTML * * @return string * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _toHtml() { $html = '<input type="text" name="' . $this->getName() . '" id="' . $this->getId() . '" '; $html .= 'value="' . $this->escapeHtml($this->getValue()) . '" '; $html .= 'class="' . $this->getClass() . '" ' . $this->getExtraParams() . '/> '; $calendarYearsRange = $this->getYearsRange(); $changeMonth = $this->getChangeMonth(); $changeYear = $this->getChangeYear(); $maxDate = $this->getMaxDate(); $showOn = $this->getShowOn(); $firstDay = $this->getFirstDay(); $html .= '<script type="text/javascript"> require(["jquery", "mage/calendar"], function($){ $("#' . $this->getId() . '").calendar({ showsTime: ' . ($this->getTimeFormat() ? 'true' : 'false') . ', ' . ($this->getTimeFormat() ? 'timeFormat: "' . $this->getTimeFormat() . '",' : '') . ' dateFormat: "' . $this->getDateFormat() . '", buttonImage: "' . $this->getImage() . '", ' . ($calendarYearsRange ? 'yearRange: "' . $calendarYearsRange . '",' : '') . ' buttonText: "' . (string)new \Magento\Framework\Phrase( 'Select Date' ) . '"' . ($maxDate ? ', maxDate: "' . $maxDate . '"' : '') . ($changeMonth === null ? '' : ', changeMonth: ' . $changeMonth) . ($changeYear === null ? '' : ', changeYear: ' . $changeYear) . ($showOn ? ', showOn: "' . $showOn . '"' : '') . ($firstDay ? ', firstDay: ' . $firstDay : '') . '}) }); </script>'; return $html; } /** * Convert special characters to HTML entities * * @return string */ public function getEscapedValue() { if ($this->getFormat() && $this->getValue()) { return strftime($this->getFormat(), strtotime($this->getValue())); } return $this->escapeHtml($this->getValue()); } /** * Produce and return block's html output * * {@inheritdoc} * * @return string */ public function getHtml() { return $this->toHtml(); } }