LLMS_Question::update_choice( array $data )

Update a question choice if no id is supplied will create a new choice


Description Description


Parameters Parameters

$data

(array) (Required) array of choice data (see $this->create_choice())


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.





Permalink: