LLMS_Question::update_choice( array $data )

Update a question choice


Description Description

If no id is supplied will create a new choice.


Top ↑

Parameters Parameters

$data

(array) (Required) Array of choice data.


Top ↑

Return Return

(string|boolean)


Top ↑

Source Source

File: includes/models/model.llms.question.php

	public function update_choice( $data ) {

		// If there's no ID, we'll add a new choice.
		if ( ! isset( $data['id'] ) ) {
			return $this->create_choice( $data );
		}

		// Get the question.
		$choice = $this->get_choice( $data['id'] );
		if ( ! $choice ) {
			return false;
		}

		$choice->update( $data )->save();

		// Return choice ID.
		return $choice->get( 'id' );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.