INSTAGRAM_PUBLISH_PHOTO::setup_action()

Setup Action.


Return Return

(Uncanny_Automatorvoid.)


Source Source

File: src/integrations/instagram/actions/instagram-publish-photo.php

	protected function setup_action() {

		$instagram = Automator()->helpers->recipe->instagram->options;

		$this->set_integration( 'INSTAGRAM' );
		$this->set_action_code( 'INSTAGRAM_PUBLISH_PHOTO' );
		$this->set_action_meta( 'INSTAGRAM_PUBLISH_PHOTO_ACCOUNT_ID' );
		$this->set_is_pro( false );
		$this->set_requires_user( false );

		/* translators: Action - WordPress */
		$this->set_sentence( sprintf( esc_attr__( 'Publish a photo to {{an Instagram Business account:%1$s}}', 'uncanny-automator' ), $this->get_action_meta() ) );

		/* translators: Action - WordPress */
		$this->set_readable_sentence( esc_attr__( 'Publish a photo to {{an Instagram Business account}}', 'uncanny-automator' ) );

		$options_group = array(
			$this->get_action_meta() => array(
				// The facebook page dropdown.
				array(
					'option_code'           => $this->get_action_meta(),
					/* translators: Email field */
					'label'                 => esc_attr__( 'Select an Instagram account', 'uncanny-automator' ),
					'input_type'            => 'select',
					'supports_custom_value' => false,
					'required'              => true,
					'options'               => $instagram->get_ig_accounts(),
				),
				// The image url.
				array(
					'option_code' => 'INSTAGRAM_IMAGE_URL',
					'label'       => esc_html__( 'Enter the image URI. The image must be JPEG or PNG.', 'uncanny-automator' ),
					'input_type'  => 'url',
					'required'    => true,
					'placeholder' => esc_html__( 'https://pathtoimage/image.jpg', 'uncanny-automator' ),
					'description' => esc_html__( 'Extended JPEG formats such as MPO and JPS are not supported.', 'uncanny-automator' ),
				),
				// The hashtags.
				array(
					'option_code' => 'INSTAGRAM_HASHTAGS',
					'label'       => esc_html__( 'Description/Hashtags', 'uncanny-automator' ),
					'input_type'  => 'textarea',
					'required'    => false,
					'placeholder' => esc_html__( 'My image #description', 'uncanny-automator' ),
					'description' => esc_html__( 'Enter the description and/or hashtags that should be posted with the image.', 'uncanny-automator' ),
				),
			),
		);

		$this->set_options_group( $options_group );

		$this->register_action();

	}