• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitExpert / magento2-force-login / 6719889768

01 Nov 2023 12:52PM UTC coverage: 58.857% (+0.5%) from 58.317%
6719889768

Pull #229

github

web-flow
Merge 663d33720 into e9ebfbc8c
Pull Request #229: issue 225

28 of 28 new or added lines in 4 files covered. (100.0%)

309 of 525 relevant lines covered (58.86%)

11.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Block/Adminhtml/Settings/Whitelist.php
1
<?php
2

3
/*
4
 * This file is part of the Force Login module for Magento2.
5
 *
6
 * (c) bitExpert AG
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace BitExpert\ForceCustomerLogin\Block\Adminhtml\Settings;
13

14
/**
15
 * Class Whitelist
16
 *
17
 * @package BitExpert\ForceCustomerLogin\Block\Adminhtml\Settings
18
 * @codingStandardsIgnoreFile
19
 */
20
class Whitelist extends \Magento\Backend\Block\Widget\Container
21
{
22
    /**
23
     * @inheritDoc
24
     */
25
    protected function _prepareLayout(): self
26
    {
27
        $restoreDefautsButtonProps = [
×
28
            'id' => 'restore_defaults',
×
29
            'label' => __('Restore Defaults'),
×
30
            'class' => 'primary add',
×
31
            'button_class' => '',
×
32
            'on_click' => "deleteConfirm('{$this->getRestoreDefaultsConfirmationText()}', '{$this->getRestoreDefaultsUrl()}')",
×
33
            'class_name' => 'Magento\Backend\Block\Widget\Button'
×
34
        ];
×
35
        $this->buttonList->add('restore_defaults', $restoreDefautsButtonProps);
×
36

37
        $addButtonProps = [
×
38
            'id' => 'add_new_entry',
×
39
            'label' => __('Add Entry'),
×
40
            'class' => 'primary add',
×
41
            'button_class' => '',
×
42
            'onclick' => "setLocation('" . $this->getCreateUrl() . "')",
×
43
            'class_name' => 'Magento\Backend\Block\Widget\Button'
×
44
        ];
×
45
        $this->buttonList->add('add_new', $addButtonProps);
×
46

47
        return parent::_prepareLayout();
×
48
    }
49

50
    /**
51
     * Retrieve restore defaults confirmation text
52
     */
53
    protected function getRestoreDefaultsConfirmationText(): string
54
    {
55
        return sprintf(
×
56
            '<p>%s</p><p>%s</p>',
×
57
            __('You will remove all existing whitelist entries and restore the defaults.'),
×
58
            __('Are you sure you want to do this?')
×
59
        );
×
60
    }
61

62
    /**
63
     * Retrieve restore defaults url
64
     */
65
    protected function getRestoreDefaultsUrl(): string
66
    {
67
        return $this->getUrl(
×
68
            'ForceCustomerLogin/Manage/RestoreDefault'
×
69
        );
×
70
    }
71

72
    /**
73
     * Retrieve create url
74
     */
75
    protected function getCreateUrl(): string
76
    {
77
        return $this->getUrl(
×
78
            'ForceCustomerLogin/Manage/Create'
×
79
        );
×
80
    }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc