| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\FormMigration\Steps; |
| 4 |
|
| 5 |
use Give\FormMigration\Contracts\FormMigrationStep; |
| 6 |
use Give\Framework\Blocks\BlockModel; |
| 7 |
use Give\Log\Log; |
| 8 |
|
| 9 |
/** |
| 10 |
* @since 3.11.0 |
| 11 |
*/ |
| 12 |
class ConvertKit extends FormMigrationStep |
| 13 |
{ |
| 14 |
/** |
| 15 |
* @since 3.11.0 |
| 16 |
*/ |
| 17 |
public function canHandle(): bool |
| 18 |
{ |
| 19 |
return $this->formV2->isConvertKitEnabled(); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* @since 3.11.0 |
| 24 |
*/ |
| 25 |
public function process(): void |
| 26 |
{ |
| 27 |
$block = BlockModel::make([ |
| 28 |
'name' => 'givewp-convertkit/convertkit', |
| 29 |
'attributes' => $this->getAttributes() |
| 30 |
]); |
| 31 |
|
| 32 |
$this->fieldBlocks->insertAfter('givewp/email', $block); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* @since 3.11.0 |
| 37 |
*/ |
| 38 |
private function getAttributes(): array |
| 39 |
{ |
| 40 |
return [ |
| 41 |
'label' => $this->formV2->getConvertKitLabel() , |
| 42 |
'defaultChecked' => $this->formV2->getConvertKitDefaultChecked(), |
| 43 |
'selectedForm' => $this->formV2->getConvertKitSelectedForm(), |
| 44 |
'tagSubscribers' => $this->formV2->getConvertKitTags() |
| 45 |
]; |
| 46 |
} |
| 47 |
} |
| 48 |
|