Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Hubspot_Helpers::get_lists()

get_lists

Contents


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 );
	}