Tribe__Tickets__Tickets_View::get_rsvp_options( string $selected = null, bool $just_labels = true )

Gets a List of Possible RSVP answers.


Parameters

$selected

(string) (Optional) Allows users to check if an option exists or get it's label.

Default value: null

$just_labels

(bool) (Optional) Whether just the options labels should be returned.

Default value: true


Top ↑

Return

(array|bool) An array containing the RSVP states, an array containing the selected option data or false if the selected option does not exist.


Top ↑

Source

File: src/Tribe/Tickets_View.php

	public function get_rsvp_options( $selected = null, $just_labels = true ) {

		$options = tribe( 'tickets.status' )->get_status_options( 'rsvp' );

		/**
		 * Allow users to add more RSVP options.
		 *
		 * Additional RSVP options should be specified in the following formats:
		 *
		 *      [
		 *          'slug' => 'Option 1 label',
		 *          'slug' => [ 'label' => 'Option 3 label' ],
		 *          'slug' => [ 'label' => 'Option 2 label', 'decrease_stock_by' => 1 ],
		 *      ]
		 *
		 * The `decrease_stock_by` key can be omitted and will default to `1`.
		 *
		 * @param array $options
		 * @param string $selected
		 */
		$options = apply_filters( 'event_tickets_rsvp_options', $options, $selected );

		$options = array_filter( $options, array( $this, 'has_rsvp_format' ) );
		array_walk( $options, array( $this, 'normalize_rsvp_option' ) );

		// If an option was passed return it's label, but if doesn't exist return false
		if ( null !== $selected ) {
			return isset( $options[ $selected  ] ) ?
                $options[ $selected  ]['label'] : false;
		}

		return $just_labels ?
			array_combine( array_keys( $options ), wp_list_pluck( $options, 'label' ) )
			: $options;
	}