LLMS_Post_Model::get_to_array_properties()

Get the properties that will be used to generate the array representation of the model.


Return Return

(string[]) Array of property keys to be used by toArray.


Top ↑

Source Source

File: includes/abstracts/abstract.llms.post.model.php

	protected function get_to_array_properties() {

		$all_props = array_keys( $this->get_properties() );

		/**
		 * Filters the properties which will excluded form the array representation of the model
		 *
		 * The dynamic portion of this hook, `$this->model_post_type`, refers to the model's post type. For example "course",
		 * "lesson", "membership", etc...
		 *
		 * @since Unknown
		 *
		 * @param string[]        $excluded  Array of property names.
		 * @param string[]        $all_props The full property list without the applied exclusions.
		 * @param LLMS_Post_Model $llms_post The LLMS_Post_Model instance.
		 */
		$excluded = apply_filters(
			"llms_get_{$this->model_post_type}_excluded_to_array_properties",
			$this->get_to_array_excluded_properties(),
			$all_props,
			$this
		);

		$props = array_diff(
			$all_props,
			$excluded
		);

		/**
		 * Filters the properties which will populate the array representation of the model.
		 *
		 * The dynamic portion of this hook, `$this->model_post_type`, refers to the model's post type. For example "course",
		 * "lesson", "membership", etc...
		 *
		 * @since Unknown
		 *
		 * @param string[]        $props     Array of property names.
		 * @param LLMS_Post_Model $llms_post The LLMS_Post_Model instance.
		 */
		return apply_filters(
			"llms_get_{$this->model_post_type}_to_array_properties",
			$props,
			$this
		);

	}

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.