Hubspot_Helpers::get_lists()

get_lists


Return Return

(void)


Source Source

File: src/integrations/hubspot/helpers/hubspot-helpers.php

	public function get_lists() {

		$options = array();

		$params = array(
			'action' => 'get_lists',
		);

		try {
			$response = $this->api_request( $params );

			$options[] = array(
				'value' => '',
				'text'  => __( 'Select a list', 'uncanny-automator' ),
			);

			foreach ( $response['data']['lists'] as $list ) {

				if ( 'STATIC' !== $list['listType'] ) {
					continue;
				}

				$options[] = array(
					'value' => $list['listId'],
					'text'  => $list['name'],
				);
			}

		} catch ( \Exception $e ) {
			$options[] = array(
				'value' => '',
				'text'  => $e->getMessage(),
			);
		}

		return apply_filters( 'automator_hubspot_options_get_lists', $options );
	}