action-factory.php
1 year ago
base-api-action.php
1 year ago
create-contact-action.php
1 year ago
get-custom-fields-action.php
1 year ago
get-lists-action.php
1 year ago
get-custom-fields-action.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace JFB_Modules\Actions_V2\Get_Response\Api; |
| 4 | |
| 5 | class Get_Custom_Fields_Action extends Base_Api_Action { |
| 6 | |
| 7 | protected $method = 'GET'; |
| 8 | |
| 9 | public function action_endpoint() { |
| 10 | return 'custom-fields'; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * @return \Generator |
| 15 | */ |
| 16 | public function generate_fields(): \Generator { |
| 17 | $custom_fields = $this->get_response_body(); |
| 18 | |
| 19 | foreach ( $custom_fields as $field ) { |
| 20 | if ( ! isset( $field['customFieldId'] ) ) { |
| 21 | continue; |
| 22 | } |
| 23 | yield array( |
| 24 | 'value' => $field['customFieldId'], |
| 25 | 'label' => $field['name'], |
| 26 | ); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | } |
| 31 |