TWITTER_POSTSTATUS_2::define_action()

Define and register the action by pushing it into the Automator object.


Source Source

File: src/integrations/twitter/actions/twitter-poststatus-2.php

	public function define_action() {

		$action = array(
			'author'             => Automator()->get_author_name( $this->action_code ),
			'support_link'       => Automator()->get_author_support_link( $this->action_code, 'integration/twitter/' ),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			'sentence'           => sprintf( __( 'Post {{a status:%1$s}} to Twitter', 'uncanny-automator' ), $this->action_meta ),
			'select_option_name' => __( 'Post {{a status}} to Twitter', 'uncanny-automator' ),
			'priority'           => 10,
			'accepted_args'      => 1,
			'requires_user'      => false,
			'execution_function' => array( $this, 'post_status' ),
			'options_group'      => array(
				$this->action_meta => array(
					Automator()->helpers->recipe->twitter->textarea_field( 
						'TWITTERSTATUSCONTENT', 
						esc_attr__( 'Status', 'uncanny-automator' ), 
						true, 
						'textarea', 
						'', 
						true,
						 esc_attr__( 'Messages posted to Twitter have a 280 character limit.', 'uncanny-automator' ),
						 __( 'Enter the message', 'uncanny-automator' ), 278 
					),
					// Image field.
					Automator()->helpers->recipe->field->text(
						array(
							'option_code' => 'TWITTERSTATUSIMAGE',
							/* translators: Image field */
							'label'       => esc_attr__( 'Image URL', 'uncanny-automator' ),
							'input_type'  => 'text',
							'default'     => '',
							'description' => 'Images posted to Twitter have a 5 Mb limit.',
							'required'    => false,
						)
					),
				),
			),
		);

		Automator()->register->action( $action );
	}