Skip to content

Commit 469b8f0

Browse files
committed
Show separate settings section for admin view transitions controls.
1 parent 2431d7a commit 469b8f0

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

plugins/view-transitions/includes/settings.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static function (): void {
264264
global $plvt_has_theme_support_with_args;
265265
?>
266266
<p class="description">
267-
<?php esc_html_e( 'This section allows you to control how view transitions are used to enhance the navigation user experience.', 'view-transitions' ); ?>
267+
<?php esc_html_e( 'This section allows you to control view transitions usage on your site to enhance the navigation user experience.', 'view-transitions' ); ?>
268268
<br>
269269
<?php esc_html_e( 'To reset any of the selector text inputs, clear the field and save the changes.', 'view-transitions' ); ?>
270270
</p>
@@ -286,36 +286,61 @@ static function (): void {
286286
)
287287
);
288288

289+
add_settings_section(
290+
'plvt_admin_view_transitions',
291+
_x( 'Admin View Transitions', 'Settings section', 'view-transitions' ),
292+
static function (): void {
293+
?>
294+
<p class="description">
295+
<?php esc_html_e( 'This section allows you to control view transitions usage in the WordPress admin area.', 'view-transitions' ); ?>
296+
</p>
297+
<?php
298+
},
299+
'reading',
300+
array(
301+
'before_section' => '<div id="admin-view-transitions">',
302+
'after_section' => '</div>',
303+
)
304+
);
305+
289306
$fields = array(
290307
'override_theme_config' => array(
308+
'section' => 'plvt_view_transitions',
291309
'title' => __( 'Override Theme Configuration', 'view-transitions' ),
292310
'description' => __( 'Override the theme provided configuration with the settings below.', 'view-transitions' ),
293311
),
294312
'default_transition_animation' => array(
313+
'section' => 'plvt_view_transitions',
295314
'title' => __( 'Default Transition Animation', 'view-transitions' ),
296315
'description' => __( 'Choose the animation that is used for the default view transition type.', 'view-transitions' ),
297316
),
298317
'header_selector' => array(
318+
'section' => 'plvt_view_transitions',
299319
'title' => __( 'Header Selector', 'view-transitions' ),
300320
'description' => __( 'Provide the CSS selector to detect the global header element.', 'view-transitions' ),
301321
),
302322
'main_selector' => array(
323+
'section' => 'plvt_view_transitions',
303324
'title' => __( 'Main Selector', 'view-transitions' ),
304325
'description' => __( 'Provide the CSS selector to detect the global main element.', 'view-transitions' ),
305326
),
306327
'post_title_selector' => array(
328+
'section' => 'plvt_view_transitions',
307329
'title' => __( 'Post Title Selector', 'view-transitions' ),
308330
'description' => __( 'Provide the CSS selector to detect the post title element.', 'view-transitions' ),
309331
),
310332
'post_thumbnail_selector' => array(
333+
'section' => 'plvt_view_transitions',
311334
'title' => __( 'Post Thumbnail Selector', 'view-transitions' ),
312335
'description' => __( 'Provide the CSS selector to detect the post thumbnail element.', 'view-transitions' ),
313336
),
314337
'post_content_selector' => array(
338+
'section' => 'plvt_view_transitions',
315339
'title' => __( 'Post Content Selector', 'view-transitions' ),
316340
'description' => __( 'Provide the CSS selector to detect the post content element.', 'view-transitions' ),
317341
),
318342
'enable_admin_transitions' => array(
343+
'section' => 'plvt_admin_view_transitions',
319344
'title' => __( 'WP Admin', 'view-transitions' ),
320345
'description' => __( 'Enable view transitions in the WordPress admin area.', 'view-transitions' ),
321346
),
@@ -327,6 +352,9 @@ static function (): void {
327352
}
328353

329354
foreach ( $fields as $slug => $args ) {
355+
$section = $args['section'];
356+
unset( $args['section'] );
357+
330358
$additional_args = array(
331359
'field' => $slug,
332360
'label_for' => "plvt-view-transitions-field-{$slug}",
@@ -342,7 +370,7 @@ static function (): void {
342370
$args['title'],
343371
'plvt_render_settings_field',
344372
'reading',
345-
'plvt_view_transitions',
373+
$section,
346374
array_merge(
347375
$additional_args,
348376
$args

0 commit comments

Comments
 (0)