Wp_Courseware_Helpers::all_wpcw_modules( string $label = null, string $option_code = 'WPCW_MODULE',  $any_option = true )


Parameters Parameters

$label

(string) (Optional)

Default value: null

$option_code

(string) (Optional)

Default value: 'WPCW_MODULE'


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/wp-courseware/helpers/wp-courseware-helpers.php

	public function all_wpcw_modules( $label = null, $option_code = 'WPCW_MODULE', $any_option = true ) {
		if ( ! $this->load_options ) {


			return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
		}



		if ( ! $label ) {
			$label = esc_attr__( 'Module', 'uncanny-automator' );
		}
		$modules = array();
		$options = array();
		if ( Automator()->helpers->recipe->load_helpers ) {
			if ( function_exists( 'wpcw_get_modules' ) ) {
				$modules = wpcw_get_modules();
			}

			if ( $any_option ) {
				$options['-1'] = esc_attr__( 'Any module', 'uncanny-automator' );
			}
			if ( ! empty( $modules ) ) {
				foreach ( $modules as $module ) {
					$options[ $module->module_id ] = $module->module_title;
				}
			}
		}
		$option = [
			'option_code'     => $option_code,
			'label'           => $label,
			'input_type'      => 'select',
			'required'        => true,
			// to setup example, lets define the value the child will be based on
			'current_value'   => false,
			'validation_type' => 'text',
			'options'         => $options,
		];

		return apply_filters( 'uap_option_all_wpcw_modules', $option );
	}