PluginProbe
View Transitions / trunk
View Transitions vtrunk
trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1
view-transitions / hooks.php

hooks.php in View Transitions trunk, at hooks.php

45 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Hook callbacks used for View Transitions.
4 *
5 * @package view-transitions
6 * @since 1.0.0
7 */
8
9 declare( strict_types = 1 );
10
11 // @codeCoverageIgnoreStart
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15 // @codeCoverageIgnoreEnd
16
17 /**
18 * Displays the HTML generator tag for the plugin.
19 *
20 * See {@see 'wp_head'}.
21 *
22 * @since 1.0.0
23 */
24 function plvt_render_generator(): void {
25 // Use the plugin slug as it is immutable.
26 echo '<meta name="generator" content="view-transitions ' . esc_attr( VIEW_TRANSITIONS_VERSION ) . '">' . "\n";
27 }
28 add_action( 'wp_head', 'plvt_render_generator' );
29
30 /**
31 * Hooks related to the key View Transitions functionality.
32 */
33 add_action( 'after_setup_theme', 'plvt_polyfill_theme_support', PHP_INT_MAX );
34 add_action( 'init', 'plvt_sanitize_view_transitions_theme_support', 1 );
35 add_action( 'wp_enqueue_scripts', 'plvt_load_view_transitions' );
36 add_action( 'admin_head', 'plvt_print_view_transitions_admin_style' );
37
38 /**
39 * Hooks related to the View Transitions settings.
40 */
41 add_action( 'init', 'plvt_register_setting' );
42 add_action( 'init', 'plvt_apply_settings_to_theme_support' );
43 add_action( 'load-options-reading.php', 'plvt_add_setting_ui' );
44 add_filter( 'plugin_action_links_' . plugin_basename( VIEW_TRANSITIONS_MAIN_FILE ), 'plvt_add_settings_action_link' );
45