Spamworldpro Mini Shell
Spamworldpro


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-two-factor-auth/Block/Adminhtml/System/Config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-two-factor-auth/Block/Adminhtml/System/Config/Providers.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);
namespace Magento\TwoFactorAuth\Block\Adminhtml\System\Config;

use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Phrase;
use Magento\Framework\Serialize\Serializer\Json;

/**
 * Displays a warning modal if the all currently available providers are deselected
 */
class Providers 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
     */
    protected function _getElementHtml(AbstractElement $element)
    {
        $html = parent::_getElementHtml($element);
        $config = [
            '#twofactorauth_general_force_providers' => [
                'Magento_TwoFactorAuth/js/system/config/providers' => [
                    'modalTitleText' => $this->getModalTitleText(),
                    'modalContentBody' => $this->getModalContentBody()
                ]
            ]
        ];
        $html .= '<script type="text/x-magento-init">' . $this->json->serialize($config) . '</script>';

        return $html;
    }

    /**
     * Get text for the modal title heading when user switches to disable
     *
     * @return Phrase
     */
    private function getModalTitleText() : Phrase
    {
        return __('Are you sure you want to disable all currently active providers?');
    }

    /**
     * Get HTML for the modal content body when user switches to disable
     *
     * @return string
     */
    private function getModalContentBody(): string
    {
        $templateFileName = $this->getTemplateFile(
            'Magento_TwoFactorAuth::system/config/providers/modal_content_body.phtml'
        );

        return $this->fetchView($templateFileName);
    }
}

Spamworldpro Mini