# ivyforms/0.8.2/backend/src/Services/Security/HCaptcha/HCaptchaConfigProvider.php

The Innovative Form Builder – IvyForms, version 0.8.2. 52 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/0.8.2/code/backend/src/Services/Security/HCaptcha/HCaptchaConfigProvider.php
- Raw: https://pluginprobe.com/plugins/ivyforms/0.8.2/raw/backend/src/Services/Security/HCaptcha/HCaptchaConfigProvider.php
- Modified: 2026-02-12T13:48:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/0.8.2/code/backend/src/Services/Security/HCaptcha/HCaptchaConfigProvider.php#L10-L20`.

```php
<?php

/**
 * @copyright © Melograno Venture Studio. All rights reserved.
 * @licence   See COPYING.md for license details.
 */

namespace IvyForms\Services\Security\HCaptcha;

// phpcs:disable PSR1.Files.SideEffects
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

use IvyForms\Services\Security\Common\CaptchaServiceInterface;

/**
 * Provides hCaptcha frontend configuration
 *
 * @package IvyForms\Services\Security\HCaptcha
 */
class HCaptchaConfigProvider
{
    /**
     * Get hCaptcha configuration for frontend
     *
     * @param CaptchaServiceInterface|null $service
     * @return array<string, mixed>
     */
    public function getConfig(?CaptchaServiceInterface $service): array
    {
        $config = [
            'configured' => false,
            'type' => 'checkbox',
            'siteKey' => '',
            'scriptUrl' => '',
            'size' => 'normal'
        ];

        if ($service && $service->isConfigured()) {
            $hcaptchaConfig = $service->getFrontendConfig(
                $service->getType(),
                $service->getSiteKey()
            );
            $hcaptchaConfig['configured'] = true;
            return $hcaptchaConfig;
        }

        return $config;
    }
}

```
