BO_AWARDACHIEVEMENT_A::define_action()

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


Source Source

File: src/integrations/badgeos/actions/bo-awardachievement-a.php

	public function define_action() {



		$action = array(
			'author'             => Automator()->get_author_name(),
			'support_link'       => Automator()->get_author_support_link($this->action_code, 'integration/badgeos/'),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			/* translators: Action - BadgeOS */
			'sentence'           => sprintf( esc_attr__( 'Award {{an achievement:%1$s}} to the user', 'uncanny-automator' ), $this->action_meta ),
			/* translators: Action - BadgeOS */
			'select_option_name' => esc_attr__( 'Award {{an achievement}} to the user', 'uncanny-automator' ),
			'priority'           => 10,
			'accepted_args'      => 1,
			'execution_function' => array( $this, 'award_an_achievement' ),
			'options_group'      => [
				$this->action_meta => [
					Automator()->helpers->recipe->badgeos->options->list_bo_award_types(
						esc_attr__( 'Achievement type', 'uncanny-automator' ),
						'BOAWARDTYPES',
						[
							'token'                 => false,
							'is_ajax'               => true,
							'target_field'          => $this->action_meta,
							'supports_custom_value' => false,
							'endpoint'              => 'select_achievements_from_types_BOAWARDACHIEVEMENT',
						]
					),

					Automator()->helpers->recipe->field->select_field_args( [
						'option_code'              => $this->action_meta,
						'options'                  => array(),
						/* translators: Noun */
						'label'                    => esc_attr__( 'Award', 'uncanny-automator' ),
						'required'                 => true,
						'custom_value_description' => esc_attr__( 'Award ID', 'uncanny-automator' ),
					] ),
				],
			],
		);

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