| 1 |
<?php |
| 2 |
/** |
| 3 |
* Integration Registered Event |
| 4 |
* |
| 5 |
* @package Forge12\DoubleOptIn\Events\Integration |
| 6 |
* @since 4.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Forge12\DoubleOptIn\Events\Integration; |
| 10 |
|
| 11 |
use Forge12\DoubleOptIn\EventSystem\Event; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Class IntegrationRegisteredEvent |
| 19 |
* |
| 20 |
* @api |
| 21 |
* |
| 22 |
* Dispatched after a form integration is registered in the registry. |
| 23 |
* Useful for extending or modifying integration behavior. |
| 24 |
* Covered by the Addon API semver policy as of Core API 4.3.0. |
| 25 |
*/ |
| 26 |
class IntegrationRegisteredEvent extends Event { |
| 27 |
|
| 28 |
/** |
| 29 |
* The integration identifier. |
| 30 |
* |
| 31 |
* @var string |
| 32 |
*/ |
| 33 |
private string $integrationId; |
| 34 |
|
| 35 |
/** |
| 36 |
* The integration display name. |
| 37 |
* |
| 38 |
* @var string |
| 39 |
*/ |
| 40 |
private string $name; |
| 41 |
|
| 42 |
/** |
| 43 |
* Whether the integration is available. |
| 44 |
* |
| 45 |
* @var bool |
| 46 |
*/ |
| 47 |
private bool $isAvailable; |
| 48 |
|
| 49 |
/** |
| 50 |
* Constructor. |
| 51 |
* |
| 52 |
* @param string $integrationId The integration identifier. |
| 53 |
* @param string $name The integration display name. |
| 54 |
* @param bool $isAvailable Whether the integration is available. |
| 55 |
*/ |
| 56 |
public function __construct( string $integrationId, string $name, bool $isAvailable ) { |
| 57 |
parent::__construct(); |
| 58 |
$this->integrationId = $integrationId; |
| 59 |
$this->name = $name; |
| 60 |
$this->isAvailable = $isAvailable; |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* {@inheritdoc} |
| 65 |
*/ |
| 66 |
public static function getWordPressHookName(): string { |
| 67 |
return 'f12_cf7_doubleoptin_integration_registered'; |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Get the integration identifier. |
| 72 |
* |
| 73 |
* @return string |
| 74 |
*/ |
| 75 |
public function getIntegrationId(): string { |
| 76 |
return $this->integrationId; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Get the integration display name. |
| 81 |
* |
| 82 |
* @return string |
| 83 |
*/ |
| 84 |
public function getName(): string { |
| 85 |
return $this->name; |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Check if the integration is available. |
| 90 |
* |
| 91 |
* @return bool True if available. |
| 92 |
*/ |
| 93 |
public function isAvailable(): bool { |
| 94 |
return $this->isAvailable; |
| 95 |
} |
| 96 |
} |
| 97 |
|