LLMS_Course::toArrayAfter( array $arr )

Add data to the course model when converted to array


Description Description

Called before data is sorted and returned by $this->jsonSerialize().


Top ↑

Parameters Parameters

$arr

(array) (Required) Data to be serialized.


Top ↑

Return Return

(array)


Top ↑

Source Source

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

	}

	/**
	 * Save instructor information
	 *
	 * @since 3.13.0
	 *
	 * @param array $instructors Array of course instructor information.
	 */
	public function set_instructors( $instructors = array() ) {

		return $this->instructors()->set_instructors( $instructors );

	}

	/**
	 * Add data to the course model when converted to array
	 *
	 * Called before data is sorted and returned by $this->jsonSerialize().
	 *
	 * @since 3.3.0
	 * @since 3.8.0 Unknown.
	 *
	 * @param array $arr Data to be serialized.
	 * @return array
	 */
	public function toArrayAfter( $arr ) {

		$product             = $this->get_product();
		$arr['access_plans'] = array();
		foreach ( $product->get_access_plans( false, false ) as $p ) {
			$arr['access_plans'][] = $p->toArray();
		}



Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0 Unknown.
3.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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