LLMS_Course::get_to_array_excluded_properties()

Get the properties that will be explicitly excluded from the array representation of the model.


Description Description

This stub can be overloaded by an extending class and the property list is filterable via the llms_get_{$this->model_post_type_excluded_to_array_properties} filter.


Top ↑

Return Return

(string[])


Top ↑

Source Source

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

	protected function get_to_array_excluded_properties() {

		/**
		 * Disable course property exclusion while running `toArray()`.
		 *
		 * This hook is intended to allow developers to retain the functionality implemented
		 * prior to the introduction of this hook.
		 *
		 * The LifterLMS developers consider the presence of these properties to be a bug but
		 * acknowledge that the removal of these properties could be seen as a backwards incompatible
		 * "feature" removal.
		 *
		 * This hook disables the exclusion of the following properties: 'average_grade', 'average_progress',
		 * 'enrolled_students', 'last_data_calc_run', and 'temp_calc_data'. Any excluded properties added in the
		 * future will not be excluded when using this hook.
		 *
		 * @example `add_filter( 'llms_course_to_array_disable_prop_exclusion', '__return_true' );`
		 *
		 * @since 5.4.1
		 *
		 * @param boolean $disable Whether or not to disable property exclusions.
		 */
		$disable = apply_filters( 'llms_course_to_array_disable_prop_exclusion', false );
		if ( $disable ) {
			return array();
		}

		return array(
			'average_grade',
			'average_progress',
			'enrolled_students',
			'last_data_calc_run',
			'temp_calc_data',
		);
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.4.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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