GP_AWARDPOINTS_A::define_action()

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


Source Source

File: src/integrations/gamipress/actions/gp-awardpoints-a.php

	public function define_action() {

		$action = [
			'author'             => Automator()->get_author_name(),
			'support_link'       => Automator()->get_author_support_link( $this->action_code, 'integration/gamipress/' ),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			/* translators: Action - GamiPress */
			'sentence'           => sprintf( esc_attr__( 'Award {{a number:%1$s}} {{of a specific type of:%2$s}} points to the user', 'uncanny-automator' ), 'GPPOINTVALUE', $this->action_meta ),
			/* translators: Action - GamiPress */
			'select_option_name' => esc_attr__( 'Award {{points}} to the user', 'uncanny-automator' ),
			'priority'           => 10,
			'accepted_args'      => 1,
			'execution_function' => [ $this, 'award_points' ],
			'options'            => array(),
			'options_group'      => [
				$this->action_meta => [
					Automator()->helpers->recipe->gamipress->options->list_gp_points_types( esc_attr__( 'Point type', 'uncanny-automator' ), $this->action_meta, [
						'token'   => false,
						'is_ajax' => false,
					] ),
				],
				'GPPOINTVALUE'     => [
					[
						'input_type' => 'int',
						'option_code' => 'GPPOINTVALUE',
						'label'       => esc_attr__( 'Points', 'uncanny-automator' ),
						'supports_tokens' => true,
						'required'        => true,
					],
				],
			],
		];
		Automator()->register->action( $action );
	}