UNCANNYCEUS_AWARDCEUS::define_action()

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


Source

File: src/integrations/uncanny-ceus/actions/uncannyceus-awardceus.php

	public function define_action() {



		$credit_designation_label_plural = get_option( 'credit_designation_label_plural', __( 'CEUs', 'uncanny-ceu' ) );

		$action = array(
			'author'             => Automator()->get_author_name( $this->action_code ),
			'support_link'       => Automator()->get_author_support_link( $this->action_code,'knowledge-base/uncanny-continuing-education-credits' ),
			'integration'        => self::$integration,
			'code'               => $this->action_code,
			/* translators: Logged-in trigger - Uncanny CEUs. 2. Credit designation label (plural) */
			'sentence'           => sprintf( esc_attr__( 'Award {{a number:%1$s}} of custom %2$s to the user', 'uncanny-automator' ), 'AWARDCEUSAMOUNT:AWARDCEUS', $credit_designation_label_plural ),
			/* translators: Logged-in trigger - Uncanny CEUs. 1. Credit designation label (plural) */
			'select_option_name' => sprintf( esc_attr__( 'Award {{a number}} of custom %1$s to the user', 'uncanny-automator' ), $credit_designation_label_plural ),
			'priority'           => 10,
			'accepted_args'      => 1,
			'execution_function' => array( $this, 'award_ceus' ),
			'options_group'      =>
				[
					'AWARDCEUS' =>
						[
							[
								'option_code' => 'AWARDCEUSDATE',
								'label'       => esc_attr__( 'Date', 'uncanny-automator' ),
								'input_type'  => 'text',
								'required'    => true,
								'description' => __( 'Format: MM/DD/YYYY Example: 12/05/2020', 'uncanny-automator' ),
							],
							[
								'option_code' => 'AWARDCEUSCOURSE',
								'label'       => esc_attr__( 'Description', 'uncanny-automator' ),
								'input_type'  => 'text',
								'required'    => true,
							],
							[
								'option_code' => 'AWARDCEUS',
								/* translators: Uncanny CEUs. 1. Credit designation label (plural) */
								'label'       => sprintf( esc_attr__( 'Number of %1$s to award', 'uncanny-automator' ), $credit_designation_label_plural ),
								'input_type'  => 'int',
								'required'    => true,

							],
						],
				],
		);

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