Server IP : 192.158.238.246 / Your IP : 3.133.112.141 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/cwd/plugins/give/src/DonationForms/Actions/ |
Upload File : |
<?php namespace Give\DonationForms\Actions; use Give\Framework\Blocks\BlockModel; use Give\Framework\FieldsAPI\Consent; class ConvertConsentBlockToFieldsApi { /** * @since 3.0.0 */ public function __invoke(BlockModel $block, int $blockIndex) { return Consent::make('consent' . '-' . $blockIndex) ->tap(function (Consent $consentField) use ($block) { if ($block->getAttribute('useGlobalSettings')) { $this->setGlobalAttributes($consentField); } else { $this->setPerFormAttributes($consentField, $block); } return $consentField; }); } /** * @since 3.0.0 * * @return void */ private function setGlobalAttributes(Consent $field) { $field ->useGlobalSettings(true) ->checkboxLabel(give_get_option('agree_to_terms_label')) ->displayType('showFormTerms') ->linkText(__('Show terms', 'give')) ->agreementText(give_get_option('agreement_text')); } /** * @since 3.0.0 * * @return void */ private function setPerFormAttributes(Consent $field, BlockModel $block) { $field ->useGlobalSettings(false) ->checkboxLabel($block->getAttribute('checkboxLabel')) ->displayType($block->getAttribute('displayType')) ->linkText($block->getAttribute('linkText')) ->linkUrl($block->getAttribute('linkUrl')) ->modalHeading($block->getAttribute('modalHeading')) ->modalAcceptanceText($block->getAttribute('modalAcceptanceText')) ->agreementText($block->getAttribute('agreementText')); } }