LD_ACHIEVEMENTS_AWARD::define_action()

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


Source

File: src/integrations/learndash/actions/ld-achievements-award.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/learndash/' ),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			/* translators: Logged-in trigger - Uncanny Groups */
			'sentence'           => sprintf( esc_attr__( 'Award {{an achievement:%1$s}} to a user', 'uncanny-automator' ), $this->action_meta ),
			/* translators: Logged-in trigger - Uncanny Groups */
			'select_option_name' => esc_attr__( 'Award {{an achievement}} to a user', 'uncanny-automator' ),
			'priority'           => 10,
			'accepted_args'      => 0,
			'execution_function' => array( $this, 'award_achievement' ),
			'options_group'      => array(
				$this->action_meta => array(
					array(
						'input_type'            => 'select',
						'option_code'           => $this->action_meta,
						'options'               => $this->get_achievements(),
						'required'              => true,
						'label'                 => esc_attr__( 'Achievements', 'uncanny-automator' ),
						'description'           => esc_attr__( 'Select from the list of available achievements.', 'uncanny-automator' ),
						'supports_token'        => false,
						'supports_custom_value' => false,
					),
				),
			),

		);

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