ActionScheduler_wpPostStore::get_post_status_by_action_status()protectedWC 1.0

Get post status by action status.

Method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_post_status_by_action_status( $action_status );
$action_status(string) (required)
Action status.

ActionScheduler_wpPostStore::get_post_status_by_action_status() code WC 8.7.0

protected function get_post_status_by_action_status( $action_status ) {

	switch ( $action_status ) {
		case self::STATUS_COMPLETE:
			$post_status = 'publish';
			break;
		case self::STATUS_CANCELED:
			$post_status = 'trash';
			break;
		default:
			if ( ! array_key_exists( $action_status, $this->get_status_labels() ) ) {
				throw new InvalidArgumentException( sprintf( 'Invalid action status: "%s".', $action_status ) );
			}
			$post_status = $action_status;
			break;
	}

	return $post_status;
}