add-tag-to-contact.php
3 years ago
base-action.php
3 years ago
create-tag-action.php
3 years ago
list-all-tags.php
3 years ago
retrieve-custom-fields-action.php
3 years ago
retrieve-lists-action.php
3 years ago
sync-contact-action.php
3 years ago
update-list-status.php
3 years ago
retrieve-lists-action.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Integrations\Active_Campaign\Api; |
| 5 | |
| 6 | |
| 7 | use Jet_Form_Builder\Classes\Arrayable\Arrayable; |
| 8 | |
| 9 | class Retrieve_Lists_Action extends Base_Action implements Arrayable { |
| 10 | |
| 11 | protected $method = \WP_REST_Server::READABLE; |
| 12 | |
| 13 | public function action_endpoint() { |
| 14 | return 'lists'; |
| 15 | } |
| 16 | |
| 17 | public function to_array(): array { |
| 18 | $response = array(); |
| 19 | $lists = $this->response_body['lists'] ?? array(); |
| 20 | |
| 21 | foreach ( $lists as $list ) { |
| 22 | $response[] = array( |
| 23 | 'value' => $list['id'], |
| 24 | 'label' => $list['name'], |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | return $response; |
| 29 | } |
| 30 | |
| 31 | } |