LLMS_Question::supports( string $feature, mixed $option = null )

Determine if the question supports a question feature


Description Description


Parameters Parameters

$feature

(string) (Required) name of the feature (eg "choices")

$option

(mixed) (Optional) allow matching feature options

Default value: null


Top ↑

Return Return

(boolean)


Top ↑

Source Source

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

	public function supports( $feature, $option = null ) {

		$ret = false;

		$type = $this->get_question_type();
		if ( $type ) {
			if ( 'choices' === $feature ) {
				$ret = ( ! empty( $type['choices'] ) );
			} elseif ( 'grading' === $feature ) {
				$ret = ( $type['grading'] && $option === $type['grading'] );
			} elseif ( 'points' === $feature ) {
				$ret = $type['points'];
			} elseif ( 'random_lock' === $feature ) {
				$ret = $type['random_lock'];
			} elseif ( 'selectable' === $feature ) {
				$ret = empty( $type['choices'] ) ? false : $type['choices']['selectable'];
			}
		}

		/**
		 * @filter   llms_{$question_type}_question_supports
		 * @param    boolean   $ret      return value
		 * @param    string    $string   name of the feature being checked (eg "choices")
		 * @param    obj       $this     instance of the LLMS_Question
		 * @usage    apply_filters( 'llms_choice_question_supports', function( $ret, $feature, $option, $question ) {
		 *           	return $ret;
		 *           }, 10, 4 );
		 */
		return apply_filters( 'llms_' . $this->get( 'question_type' ) . '_question_supports', $ret, $feature, $option, $this );

	}

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: