![]() 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/module-security/Block/Config/Backend/Session/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * System config email field backend model */ declare(strict_types=1); namespace Magento\Security\Block\Config\Backend\Session; use Magento\Backend\Block\Template\Context; use Magento\Config\Block\System\Config\Form\Field; use Magento\Framework\Data\Form\Element\AbstractElement; use Magento\Framework\Exception\ValidatorException; use Magento\Framework\Serialize\Serializer\Json; /** * Backend Model for Max Session Size */ class SessionSize extends Field { /** * @var Json */ private $json; /** * @param Context $context * @param Json $json * @param array $data */ public function __construct( Context $context, Json $json, array $data = [] ) { parent::__construct($context, $data); $this->json = $json; } /** * {@inheritdoc} * @throws ValidatorException */ protected function _getElementHtml(AbstractElement $element) { $html = parent::_getElementHtml($element); $originalData = $element->getOriginalData(); $maxSessionSizeAdminSelector = '#' . $element->getHtmlId(); $jsString = '<script type="text/x-magento-init"> {"' . $maxSessionSizeAdminSelector . '": { "Magento_Security/js/system/config/session-size": {"modalTitleText": ' . $this->json->serialize(__($originalData['modal_title_text'])) . ', "modalContentBody": ' . $this->json->serialize($this->getModalContentBody($originalData['modal_content_body_path'])) . '}}}</script>'; $html .= $jsString; return $html; } /** * Get HTML for the modal content body when user switches to disable * * @param string $templatePath * @return string * @throws ValidatorException */ private function getModalContentBody(string $templatePath) { $templateFileName = $this->getTemplateFile($templatePath); return $this->fetchView($templateFileName); } }