Skip to content

Commit 26af2a7

Browse files
Add admin file for admin related functions
1 parent 2a1c1ba commit 26af2a7

File tree

3 files changed

+36
-22
lines changed

3 files changed

+36
-22
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Admin related functions for View Transitions.
4+
*
5+
* @package view-transitions
6+
* @since 1.0.0
7+
*/
8+
9+
// @codeCoverageIgnoreStart
10+
if ( ! defined( 'ABSPATH' ) ) {
11+
exit; // Exit if accessed directly.
12+
}
13+
// @codeCoverageIgnoreEnd
14+
15+
/**
16+
* Outputs the necessary CSS styles for view transitions.
17+
*
18+
* This function is responsible for printing the required inline styles
19+
* to enable or enhance view transitions within the theme or plugin.
20+
* It should be hooked to an appropriate action to ensure the styles
21+
* are included in the page output.
22+
*
23+
* @since n.e.x.t
24+
*/
25+
function plvt_print_view_transitions_admin_style(): void {
26+
$options = plvt_get_stored_setting_value();
27+
if ( ! isset( $options['enable_admin_transitions'] ) || true !== $options['enable_admin_transitions'] ) {
28+
return;
29+
}
30+
?>
31+
<style>
32+
@view-transition { navigation: auto; }
33+
</style>
34+
<?php
35+
}

plugins/view-transitions/includes/theme.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -355,25 +355,3 @@ function plvt_load_view_transitions(): void {
355355
wp_add_inline_script( 'plvt-view-transitions', $init_script );
356356
wp_enqueue_script( 'plvt-view-transitions' );
357357
}
358-
359-
/**
360-
* Outputs the necessary CSS styles for view transitions.
361-
*
362-
* This function is responsible for printing the required inline styles
363-
* to enable or enhance view transitions within the theme or plugin.
364-
* It should be hooked to an appropriate action to ensure the styles
365-
* are included in the page output.
366-
*
367-
* @since n.e.x.t
368-
*/
369-
function plvt_print_view_transitions_admin_style(): void {
370-
$options = plvt_get_stored_setting_value();
371-
if ( ! isset( $options['enable_admin_transitions'] ) || true !== $options['enable_admin_transitions'] ) {
372-
return;
373-
}
374-
?>
375-
<style>
376-
@view-transition { navigation: auto; }
377-
</style>
378-
<?php
379-
}

plugins/view-transitions/view-transitions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
define( 'VIEW_TRANSITIONS_VERSION', '1.0.1' );
2929
define( 'VIEW_TRANSITIONS_MAIN_FILE', __FILE__ );
3030

31+
require_once __DIR__ . '/includes/admin.php';
3132
require_once __DIR__ . '/includes/class-plvt-view-transition-animation.php';
3233
require_once __DIR__ . '/includes/class-plvt-view-transition-animation-registry.php';
3334
require_once __DIR__ . '/includes/functions.php';

0 commit comments

Comments
 (0)