GP_EARNSSPECIFICPOINTS::define_trigger()

Define trigger settings


Source Source

File: src/integrations/gamipress/triggers/gp-earnsspecificpoints.php

	public function define_trigger() {
		$trigger = array(
			'author'              => Automator()->get_author_name( $this->trigger_code ),
			'support_link'        => Automator()->get_author_support_link( $this->trigger_code, 'integration/gamipress/' ),
			'integration'         => self::$integration,
			'code'                => $this->trigger_code,
			/* translators: Logged-in trigger - GamiPress */
			'sentence'            => sprintf( esc_attr__( 'A user earns {{greater than, less than, or equal to:%3$s}} {{a number of:%1$s}} {{a specific type of:%2$s}} points in a single transaction', 'uncanny-automator-pro' ), 'GPPOINTVALUE', $this->trigger_meta, 'NUMBERCOND' ),
			/* translators: Logged-in trigger - GamiPress */
			'select_option_name'  => esc_attr__( 'A user earns {{greater than, less than, or equal to}} {{a number of}} {{a specific type of}} points in a single transaction', 'uncanny-automator-pro' ),
			'action'              => 'gamipress_award_points_to_user',
			'priority'            => 20,
			'accepted_args'       => 4,
			'validation_function' => array( $this, 'earns_specific_points' ),
			'options'             => array(
				Automator()->helpers->recipe->gamipress->options->list_gp_points_types( esc_attr__( 'Point type', 'uncanny-automator' ), $this->trigger_meta ),
				Automator()->helpers->recipe->field->int(
					array(
						'option_code' => 'GPPOINTVALUE',
						'label'       => esc_attr__( 'Points', 'uncanny-automator-pro' ),
						'placeholder' => esc_attr__( 'Example: 15', 'uncanny-automator-pro' ),
						'input_type'  => 'int',
						'default'     => null,
					)
				),
				Automator()->helpers->recipe->field->less_or_greater_than(),
			),
		);
		Automator()->register->trigger( $trigger );
	}