WPF_ADDEDTOPIC::load_options()

Contents


Return Return

(array[])


Source Source

File: src/integrations/wpforo/triggers/wpf-addedtopic.php

	public function load_options() {
		$forums = WPF()->forum->get_forums( array( 'type' => 'forum' ) );
		$forum_options = array( 0 => 'Any Forum' );
		foreach ( $forums as $forum ) {
			$forum_options[ $forum['forumid'] ] = $forum['title'];
		}
		$forum_relevant_tokens = array(
			'WPFORO_FORUM'         => __( 'Forum title', 'uncanny-automator' ),
			'WPFORO_FORUM_ID'      => __( 'Forum ID', 'uncanny-automator' ),
			'WPFORO_FORUM_URL'     => __( 'Forum URL', 'uncanny-automator' ),
			'WPFORO_TOPIC'         => __( 'Topic title', 'uncanny-automator' ),
			'WPFORO_TOPIC_ID'      => __( 'Topic ID', 'uncanny-automator' ),
			'WPFORO_TOPIC_URL'     => __( 'Topic URL', 'uncanny-automator' ),
			'WPFORO_TOPIC_CONTENT' => __( 'Topic content', 'uncanny-automator' ),
		);
		return Automator()->utilities->keep_order_of_options(
			array(
				'options' => array(
					Automator()->helpers->recipe->field->select_field_args(
						array(
							'option_code'     => $this->trigger_meta,
							'options'         => $forum_options,
							'label'           => esc_attr__( 'Forums', 'uncanny-automator' ),
							'required'        => true,
							'token_name'      => 'Forum ID',
							'relevant_tokens' => $forum_relevant_tokens,
						)
					),
					Automator()->helpers->recipe->options->number_of_times(),
				),
			)
		);
	}