Skip to content

Commit e7e56a9

Browse files
committed
Add Layout Processor
1 parent 03651fd commit e7e56a9

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe.
4+
* All Rights Reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
namespace Magento\Captcha\Block\Checkout;
9+
10+
use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
11+
use Magento\Captcha\Helper\Data as HelperCaptcha;
12+
13+
class LayoutProcessor implements LayoutProcessorInterface
14+
{
15+
/**
16+
* @param HelperCaptcha $helper
17+
*/
18+
public function __construct(
19+
private readonly HelperCaptcha $helper
20+
) {
21+
}
22+
23+
/**
24+
* Process jsLayout of checkout page
25+
*
26+
* @param array $jsLayout
27+
* @return array
28+
*/
29+
public function process($jsLayout): array
30+
{
31+
if ($this->helper->getConfig('enable')) {
32+
$jsLayout['components']['authenticationPopup']['children']['captcha'] = [
33+
'component' => 'Magento_Captcha/js/view/checkout/loginCaptcha',
34+
'displayArea' => 'additional-login-form-fields',
35+
'formId' => 'user_login',
36+
'configSource' => 'checkout'
37+
];
38+
}
39+
return $jsLayout;
40+
}
41+
}

0 commit comments

Comments
 (0)