LLMS_REST_Controller::exclude_disallowed_meta_fields( array $meta, array $schema = array() )

Exclude disallowed meta fields.


Parameters Parameters

$meta

(array) (Required) Array of meta fields.

$schema

(array) (Optional) The resource item schema. Falls back on the defined schema if not supplied.

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-controller.php

	protected function exclude_disallowed_meta_fields( $meta, $schema = array() ) {

		$schema = empty( $schema ) ? $this->schema : $schema;

		if ( empty( $schema ) || empty( $meta ) ) {
			return $meta;
		}

		$object_type = $this->get_object_type( $schema );

		/**
		 * Filters the disallowed meta fields.
		 *
		 * The dynamic portion of the hook name, `$object_type`, refers the object type this controller is responsible for managing.
		 *
		 * @since 1.0.0-beta.27
		 *
		 * @param string[] $disallowed_meta_fields Meta field names to skip (added via `register_meta()`).
		 */
		$disallowed_meta_fields = apply_filters( "llms_rest_{$object_type}_disallowed_meta_fields", $this->disallowed_meta_fields );

		$meta = array_diff_key(
			$meta,
			array_flip( $disallowed_meta_fields )
		);

		return $meta;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.27 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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