Form_Edit_Page_Handler::maybe_enqueue_assets( string $hook_suffix )

Enqueues assets to load if conditions are met.

Description

Parameters

$hook_suffix

(string) (Required) Current hook suffix.

Source

File: src/db-objects/forms/form-edit-page-handler.php

	public function maybe_enqueue_assets( $hook_suffix ) {
		if ( 'post-new.php' !== $hook_suffix && 'post.php' !== $hook_suffix ) {
			return;
		}

		$target_post_type = $this->form_manager->get_prefix() . $this->form_manager->get_singular_slug();

		if ( empty( $_GET['post_type'] ) || $target_post_type !== $_GET['post_type'] ) {
			if ( empty( $_GET['post'] ) || get_post_type( $_GET['post'] ) !== $target_post_type ) {
				return;
			}
		}

		$this->enqueue_assets();
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.