1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | namespace Firegento\DevDashboard\Block\System\Account\Edit; |
||
5 | |||
6 | use Magento\Config\Model\Config\Source\Yesno; |
||
7 | use Magento\Framework\App\ObjectManager; |
||
8 | use Magento\Framework\Locale\OptionInterface; |
||
9 | |||
10 | class Form extends \Magento\Backend\Block\System\Account\Edit\Form |
||
11 | { |
||
12 | private $yesno; |
||
13 | |||
14 | private $deployedLocales; |
||
15 | |||
16 | public function __construct( |
||
17 | \Magento\Backend\Block\Template\Context $context, |
||
18 | \Magento\Framework\Registry $registry, |
||
19 | \Magento\Framework\Data\FormFactory $formFactory, |
||
20 | \Magento\User\Model\UserFactory $userFactory, |
||
0 ignored issues
–
show
|
|||
21 | \Magento\Backend\Model\Auth\Session $authSession, |
||
22 | \Magento\Framework\Locale\ListsInterface $localeLists, |
||
23 | array $data = [], |
||
24 | OptionInterface $deployedLocales = null, |
||
25 | Yesno $yesno |
||
26 | ) { |
||
27 | parent::__construct($context, $registry, $formFactory, $userFactory, $authSession, $localeLists, $data, $deployedLocales); |
||
28 | $this->yesno = $yesno; |
||
29 | $this->deployedLocales = $deployedLocales |
||
30 | ?: ObjectManager::getInstance()->get(OptionInterface::class);; |
||
0 ignored issues
–
show
|
|||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @inheritdoc |
||
35 | */ |
||
36 | protected function _prepareForm() |
||
37 | { |
||
38 | $userId = $this->_authSession->getUser()->getId(); |
||
39 | $user = $this->_userFactory->create()->load($userId); |
||
40 | $user->unsetData('password'); |
||
41 | |||
42 | /** @var \Magento\Framework\Data\Form $form */ |
||
43 | $form = $this->_formFactory->create(); |
||
44 | |||
45 | $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Account Information')]); |
||
46 | |||
47 | $fieldset->addField( |
||
48 | 'username', |
||
49 | 'text', |
||
50 | ['name' => 'username', 'label' => __('User Name'), 'title' => __('User Name'), 'required' => true] |
||
51 | ); |
||
52 | |||
53 | $fieldset->addField( |
||
54 | 'firstname', |
||
55 | 'text', |
||
56 | ['name' => 'firstname', 'label' => __('First Name'), 'title' => __('First Name'), 'required' => true] |
||
57 | ); |
||
58 | |||
59 | $fieldset->addField( |
||
60 | 'lastname', |
||
61 | 'text', |
||
62 | ['name' => 'lastname', 'label' => __('Last Name'), 'title' => __('Last Name'), 'required' => true] |
||
63 | ); |
||
64 | |||
65 | $fieldset->addField('user_id', 'hidden', ['name' => 'user_id']); |
||
66 | |||
67 | $fieldset->addField( |
||
68 | 'email', |
||
69 | 'text', |
||
70 | ['name' => 'email', 'label' => __('Email'), 'title' => __('User Email'), 'required' => true] |
||
71 | ); |
||
72 | |||
73 | $fieldset->addField( |
||
74 | 'password', |
||
75 | 'password', |
||
76 | [ |
||
77 | 'name' => 'password', |
||
78 | 'label' => __('New Password'), |
||
79 | 'title' => __('New Password'), |
||
80 | 'class' => 'validate-admin-password' |
||
81 | ] |
||
82 | ); |
||
83 | |||
84 | $fieldset->addField( |
||
85 | 'confirmation', |
||
86 | 'password', |
||
87 | [ |
||
88 | 'name' => 'password_confirmation', |
||
89 | 'label' => __('Password Confirmation'), |
||
90 | 'class' => 'validate-cpassword' |
||
91 | ] |
||
92 | ); |
||
93 | |||
94 | $fieldset->addField( |
||
95 | 'interface_locale', |
||
96 | 'select', |
||
97 | [ |
||
98 | 'name' => 'interface_locale', |
||
99 | 'label' => __('Interface Locale'), |
||
100 | 'title' => __('Interface Locale'), |
||
101 | 'values' => $this->deployedLocales->getTranslatedOptionLocales(), |
||
102 | 'class' => 'select' |
||
103 | ] |
||
104 | ); |
||
105 | |||
106 | $fieldset->addField( |
||
107 | 'use_devdashboard', |
||
108 | 'select', |
||
109 | [ |
||
110 | 'name' => 'use_devdashboard', |
||
111 | 'label' => __('Use developer dashboard as default'), |
||
112 | 'title' => __('Use developer dashboard'), |
||
113 | 'values' => $this->yesno->toOptionArray(), |
||
114 | 'class' => 'select' |
||
115 | ] |
||
116 | ); |
||
117 | |||
118 | $verificationFieldset = $form->addFieldset( |
||
119 | 'current_user_verification_fieldset', |
||
120 | ['legend' => __('Current User Identity Verification')] |
||
121 | ); |
||
122 | $verificationFieldset->addField( |
||
123 | self::IDENTITY_VERIFICATION_PASSWORD_FIELD, |
||
124 | 'password', |
||
125 | [ |
||
126 | 'name' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD, |
||
127 | 'label' => __('Your Password'), |
||
128 | 'id' => self::IDENTITY_VERIFICATION_PASSWORD_FIELD, |
||
129 | 'title' => __('Your Password'), |
||
130 | 'class' => 'validate-current-password required-entry', |
||
131 | 'required' => true |
||
132 | ] |
||
133 | ); |
||
134 | |||
135 | $data = $user->getData(); |
||
136 | unset($data[self::IDENTITY_VERIFICATION_PASSWORD_FIELD]); |
||
137 | $form->setValues($data); |
||
138 | $form->setAction($this->getUrl('adminhtml/system_account/save')); |
||
139 | $form->setMethod('post'); |
||
140 | $form->setUseContainer(true); |
||
141 | $form->setId('edit_form'); |
||
142 | |||
143 | $this->setForm($form); |
||
144 | |||
145 | return \Magento\Backend\Block\Widget\Form::_prepareForm(); |
||
146 | } |
||
147 | } |
||
148 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths