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_fields( $exclude = array() )

get_fields

Contents


Return Return

(void)


Source Source

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

	public function get_fields( $exclude = array() ) {
		$fields = array();
		$request_params = array(
			'action' => 'get_fields',
		);
		try {
			$response = $this->api_request( $request_params );
			$fields[] = array(
						'value' => '',
						'text'  => __( 'Select a field', 'uncanny-automator' ),
			);
			foreach ( $response['data'] as $field ) {
				if ( in_array( $field['name'], $exclude, true ) ) {
					continue;
				}
				if ( $field['readOnlyValue'] ) {
					continue;
				}
				$fields[] = array(
					'value' => $field['name'],
					'text'  => $field['label'],
				);
			}
		} catch ( \Exception $e ) {
			$fields[] = array(
				'value' => '',
				'text'  => $e->getMessage(),
			);
		}
		return $fields;
	}