MYCRED_AWARDBADGE_A::define_action()

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


Source Source

File: src/integrations/mycred/actions/mycred-awardbadge-a.php

	public function define_action() {



		$action = [
			'author'             => Automator()->get_author_name(),
			'support_link'       => Automator()->get_author_support_link( $this->action_code, 'integration/mycred/' ),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			/* translators: Action - myCred */
			'sentence'           => sprintf( esc_attr__( 'Award {{a badge:%1$s}} to the user', 'uncanny-automator' ), $this->action_meta ),
			/* translators: Action - myCred */
			'select_option_name' => esc_attr__( 'Award {{a badge}} to the user', 'uncanny-automator' ),
			'priority'           => 10,
			'accepted_args'      => 1,
			'execution_function' => [ $this, 'award_mycred_badge' ],
			'options'            => array(),
			'options_group'      => [
				$this->action_meta => [
					/* translators: Noun */
					Automator()->helpers->recipe->mycred->options->list_mycred_badges(
						esc_attr__( 'Badge', 'uncanny-automator' ),
						$this->action_meta,
						[
							'token'        => false,
							'is_ajax'      => true,
							'target_field' => $this->action_meta,
						]
					),
				],
			],
		];

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