AC_ANNON_ADD::get_fields()

Get the fields.


Source Source

File: src/integrations/active-campaign/actions/ac-annon-add.php

	public function get_fields() {

		$custom_fields = get_transient( 'ua_ac_contact_fields_list' );

		$ac_helper = Automator()->helpers->recipe->active_campaign->options;

		if ( false === $custom_fields ) {
			$ac_helper->sync_contact_fields( false );
		}

		// Default ActiveCampaign fields.
		$fields = array(
			array(
				'option_code' => $this->get_action_meta(),
				/* translators: Email address */
				'label'       => esc_attr__( 'Email address', 'uncanny-automator' ),
				'input_type'  => 'email',
				'required'    => true,
			),
			array(
				'option_code' => $this->prefix . '_FIRST_NAME',
				/* translators: First name */
				'label'       => esc_attr__( 'First name', 'uncanny-automator' ),
				'input_type'  => 'text',
				'required'    => true,
			),
			array(
				'option_code' => $this->prefix . '_LAST_NAME',
				/* translators: Last name */
				'label'       => esc_attr__( 'Last name', 'uncanny-automator' ),
				'input_type'  => 'text',
				'required'    => true,
			),
			array(
				'option_code' => $this->prefix . '_PHONE',
				'label'       => esc_attr__( 'Phone number', 'uncanny-automator' ),
				'placeholder' => esc_attr__( '(+00) 987 123 4567', 'uncanny-automator' ),
				'input_type'  => 'text',
			),
		);

		// Add the custom fields options.
		$fields = array_merge( $fields, $ac_helper->get_custom_fields( $this->prefix ) );

		// Add the checkbox.
		$fields[] = array(
			'option_code' => $this->prefix . '_UPDATE_IF_CONTACT_EXISTS',
			'label'       => esc_attr__( 'If the contact already exists, update their info.', 'uncanny-automator' ),
			'input_type'  => 'checkbox',
		);

		return $fields;

	}