[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-block-templates-registry.php (summary)

Templates registry functions.

File Size: 256 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 8 functions

  register()
  get_all_registered()
  get_registered()
  get_by_slug()
  get_by_query()
  is_registered()
  unregister()
  get_instance()

Functions
Functions that are not part of a class:

register( $template_name, $args = array()   X-Ref
Registers a template.

param: string $template_name Template name including namespace.
param: array  $args          Optional. Array of template arguments.
return: WP_Block_Template|WP_Error The registered template on success, or WP_Error on failure.

get_all_registered()   X-Ref
Retrieves all registered templates.

return: WP_Block_Template[] Associative array of `$template_name => $template` pairs.

get_registered( $template_name )   X-Ref
Retrieves a registered template by its name.

param: string $template_name Template name including namespace.
return: WP_Block_Template|null The registered template, or null if it is not registered.

get_by_slug( $template_slug )   X-Ref
Retrieves a registered template by its slug.

param: string $template_slug Slug of the template.
return: WP_Block_Template|null The registered template, or null if it is not registered.

get_by_query( $query = array()   X-Ref
Retrieves registered templates matching a query.

param: array  $query {
return: WP_Block_Template[] Associative array of `$template_name => $template` pairs.

is_registered( $template_name )   X-Ref
Checks if a template is registered.

param: string $template_name Template name.
return: bool True if the template is registered, false otherwise.

unregister( $template_name )   X-Ref
Unregisters a template.

param: string $template_name Template name including namespace.
return: WP_Block_Template|WP_Error The unregistered template on success, or WP_Error on failure.

get_instance()   X-Ref
Utility method to retrieve the main instance of the class.

The instance will be created if it does not exist yet.

return: WP_Block_Templates_Registry The main instance.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref