DeprecateOldTemplateHook.php
5 years ago
HookCommandInterface.php
5 years ago
SetupFieldConfirmation.php
5 years ago
SetupFieldEmailTag.php
5 years ago
SetupFieldPersistance.php
5 years ago
SetupFieldReceipt.php
5 years ago
SetupFieldValidation.php
5 years ago
SetupNewTemplateHook.php
5 years ago
SetupPaymentDetailsDisplay.php
5 years ago
SetupNewTemplateHook.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Form\LegacyConsumer\Commands; |
| 4 | |
| 5 | use Give\Framework\FieldsAPI\FieldCollection; |
| 6 | use Give\Form\LegacyConsumer\FieldView; |
| 7 | |
| 8 | /** |
| 9 | * @since 2.10.2 |
| 10 | */ |
| 11 | class SetupNewTemplateHook implements HookCommandInterface { |
| 12 | |
| 13 | /** |
| 14 | * @since 2.10.2 |
| 15 | * |
| 16 | * @param string $hook |
| 17 | * |
| 18 | * @return void |
| 19 | */ |
| 20 | public function __invoke( $hook ) { |
| 21 | |
| 22 | // On the old hook, run the new hook and render the fields. |
| 23 | add_action( |
| 24 | "give_$hook", |
| 25 | function( $formID ) use ( $hook ) { |
| 26 | $fieldCollection = new FieldCollection( 'root' ); |
| 27 | do_action( "give_fields_$hook", $fieldCollection, $formID ); |
| 28 | foreach ( $fieldCollection->getFields() as $field ) { |
| 29 | FieldView::render( $field ); |
| 30 | } |
| 31 | } |
| 32 | ); |
| 33 | } |
| 34 | } |
| 35 |