UOG_CREATEUNCANNYGROUP::load_options()


Return Return

(array)


Source Source

File: src/integrations/uncanny-groups/actions/uog-createuncannygroup.php

	public function load_options() {

		$args = array(
			'post_type'      => 'sfwd-courses',
			'posts_per_page' => 999,
			'orderby'        => 'title',
			'order'          => 'ASC',
			'post_status'    => 'publish',
		);

		$options = Automator()->helpers->recipe->options->wp_query( $args );

		$user_warning = sprintf(
			'%s <em>%s</em>',
			esc_attr__( 'Only users with the Group Leader role can be made the leader of a group.', 'uncanny-automator' ),
			esc_attr__( 'This action will not alter the roles of Admin users.', 'uncanny-automator' )
		);
		$options      = array(
			'options_group' =>
				array(
					$this->action_meta =>
						array(
							array(
								'option_code' => 'UOGROUPTITLE',
								'label'       => esc_attr__( 'Group name', 'uncanny-automator' ),
								'input_type'  => 'text',
								'required'    => true,
							),
							array(
								'option_code'              => 'UOGROUPCOURSES',
								'label'                    => esc_attr__( 'Group courses', 'uncanny-automator' ),
								'input_type'               => 'select',
								'required'                 => true,
								'supports_multiple_values' => true,
								'options'                  => $options,
							),
							array(
								'option_code' => 'UOGROUPNUMSEATS',
								'label'       => esc_attr__( 'Number of seats', 'uncanny-automator' ),
								'input_type'  => 'int',
								'required'    => true,

							),
							array(
								'input_type'            => 'select',
								'option_code'           => 'GROUP_LEADER_ROLE_ASSIGNMENT',
								/* translators: Uncanny Groups */
								'label'                 => esc_attr__( 'If the user does not currently have the Group Leader role', 'uncanny-automator' ),
								'description'           => '<div class="user-selector__warning">' . $user_warning . '</div>',
								'required'              => true,
								'default_value'         => 'do_nothing',
								'options'               => array(
									'do_nothing' => esc_attr__( 'Do nothing', 'uncanny-automator' ),
									'add'        => esc_attr__( 'Add the role to their existing role(s)', 'uncanny-automator' ),
									'replace'    => esc_attr__( 'Replace their existing role(s) with the Group Leader role', 'uncanny-automator' ),
								),
								'supports_custom_value' => false,
								'supports_tokens'       => false,
							),
						),
				),
		);

		return Automator()->utilities->keep_order_of_options( $options );
	}