wppaste
WordPress

WP_REST_Font_Families_Controller

Since
6.5.0
Source
wp-includes/rest-api/endpoints/class-wp-rest-font-families-controller.php:15
Font Families Controller class.

Compatibility

WordPress
since 6.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 2

Every hook that fires from inside WP_REST_Font_Families_Controller, in the order it appears in the class, grouped by the method that fires it.

Properties · 1

$allow_batchfalseprotected
Whether the controller supports batching.

Methods · 16

Source code

class WP_REST_Font_Families_Controller extends WP_REST_Posts_Controller { 	/**	 * The latest version of theme.json schema supported by the controller.	 *	 * @since 6.5.0	 * @var int	 */	const LATEST_THEME_JSON_VERSION_SUPPORTED = 3; 	/**	 * Whether the controller supports batching.	 *	 * @since 6.5.0	 * @var false	 */	protected $allow_batch = false; 	/**	 * Checks if a given request has access to font families.	 *	 * @since 6.5.0	 *	 * @param WP_REST_Request $request Full details about the request.	 * @return true|WP_Error True if the request has read access, WP_Error object otherwise.	 */	public function get_items_permissions_check( $request ) {		$post_type = get_post_type_object( $this->post_type ); 		if ( ! current_user_can( $post_type->cap->read ) ) {			return new WP_Error(				'rest_cannot_read',				__( 'Sorry, you are not allowed to access font families.' ),				array( 'status' => rest_authorization_required_code() )			);		} 		return true;	} 	/**	 * Checks if a given request has access to a font family.	 *	 * @since 6.5.0	 *	 * @param WP_REST_Request $request Full details about the request.	 * @return true|WP_Error True if the request has read access, WP_Error object otherwise.	 */	public function get_item_permissions_check( $request ) {		$post = $this->get_post( $request['id'] );		if ( is_wp_error( $post ) ) {			return $post;		} 		if ( ! current_user_can( 'read_post', $post->ID ) ) {			return new WP_Error(				'rest_cannot_read',				__( 'Sorry, you are not allowed to access this font family.' ),				array( 'status' => rest_authorization_required_code() )			);		} 		return true;	} 	/**	 * Validates settings when creating or updating a font family.	 *	 * @since 6.5.0	 *	 * @param string          $value   Encoded JSON string of font family settings.	 * @param WP_REST_Request $request Request object.	 * @return true|WP_Error True if the settings are valid, otherwise a WP_Error object.	 */	public function validate_font_family_settings( $value, $request ) {		// Enforce JSON Schema validity for field before applying custom validation logic.		$args     = $this->get_endpoint_args_for_item_schema( $request->get_method() );		$validity = rest_validate_value_from_schema( $value, $args['font_family_settings'], 'font_family_settings' ); 		if ( is_wp_error( $validity ) ) {

Changelog

Introduced in 6.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/rest-api/endpoints/class-wp-rest-font-families-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.