Skip to content

Commit 3f8d0e4

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents d21ebdc + e7f523f commit 3f8d0e4

10 files changed

Lines changed: 49 additions & 17 deletions

src/wp-admin/css/colors/_tokens.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ $line-height-xs: 16px; // xs
171171
$line-height-s: 20px; // s - Most UI elements
172172
$line-height-m: 24px; // m - Body large
173173

174-
// Font Weights
175-
$font-weight-regular: 400; // Regular - Body text
176-
$font-weight-medium: 500; // Medium - Headings, buttons
177-
178-
179174
// --------------------------------------------------------------------------
180175
// Elevation (Box Shadows)
181176
// --------------------------------------------------------------------------

src/wp-admin/customize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
<?php if ( $compatible_wp && $compatible_php ) : ?>
199199
<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
200200
<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
201-
<?php submit_button( $save_text, 'primary button-compact save', 'save', false ); ?>
201+
<?php submit_button( $save_text, 'primary compact save', 'save', false ); ?>
202202
<button id="publish-settings" class="publish-settings button-primary button-compact button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
203203
</div>
204204
<?php else : ?>

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ protected function extra_tablenav( $which ) {
442442

443443
if ( ! empty( $output ) && $this->has_items() ) {
444444
echo $output;
445-
submit_button( __( 'Filter' ), 'button-compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
445+
submit_button( __( 'Filter' ), 'compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
446446
}
447447
}
448448

src/wp-admin/includes/class-wp-links-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function extra_tablenav( $which ) {
123123

124124
wp_dropdown_categories( $dropdown_options );
125125

126-
submit_button( __( 'Filter' ), 'button-compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
126+
submit_button( __( 'Filter' ), 'compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
127127
?>
128128
</div>
129129
<?php

src/wp-admin/includes/class-wp-list-table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public function search_box( $text, $input_id ) {
416416
<p class="search-box">
417417
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
418418
<input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
419-
<?php submit_button( $text, 'button-compact', '', false, array( 'id' => 'search-submit' ) ); ?>
419+
<?php submit_button( $text, 'compact', '', false, array( 'id' => 'search-submit' ) ); ?>
420420
</p>
421421
<?php
422422
}
@@ -632,7 +632,7 @@ protected function bulk_actions( $which = '' ) {
632632

633633
echo "</select>\n";
634634

635-
submit_button( __( 'Apply' ), 'action button-compact', 'bulk_action', false, array( 'id' => "doaction$two" ) );
635+
submit_button( __( 'Apply' ), 'action compact', 'bulk_action', false, array( 'id' => "doaction$two" ) );
636636
echo "\n";
637637
}
638638

src/wp-admin/includes/class-wp-media-list-table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ protected function extra_tablenav( $which ) {
242242
/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
243243
do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
244244

245-
submit_button( __( 'Filter' ), 'button-compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
245+
submit_button( __( 'Filter' ), 'compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
246246

247247
if ( $this->is_trash && $this->has_items()
248248
&& current_user_can( 'edit_others_posts' )
249249
) {
250-
submit_button( __( 'Empty Trash' ), 'apply button-compact', 'delete_all', false );
250+
submit_button( __( 'Empty Trash' ), 'apply compact', 'delete_all', false );
251251
}
252252
?>
253253
</div>

src/wp-admin/includes/class-wp-posts-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ protected function extra_tablenav( $which ) {
596596

597597
if ( ! empty( $output ) ) {
598598
echo $output;
599-
submit_button( __( 'Filter' ), 'button-compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
599+
submit_button( __( 'Filter' ), 'compact', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
600600
}
601601
}
602602

src/wp-admin/includes/media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2905,7 +2905,7 @@ function media_upload_library_form( $errors ) {
29052905
</select>
29062906
<?php } ?>
29072907

2908-
<?php submit_button( __( 'Filter &#187;' ), 'button-compact', 'post-query-submit', false ); ?>
2908+
<?php submit_button( __( 'Filter &#187;' ), 'compact', 'post-query-submit', false ); ?>
29092909

29102910
</div>
29112911

src/wp-admin/includes/template.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,7 +2562,7 @@ function compression_test() {
25622562
*
25632563
* @param string $text Optional. The text of the button. Defaults to 'Save Changes'.
25642564
* @param string $type Optional. The type and CSS class(es) of the button. Core values
2565-
* include 'primary', 'small', and 'large'. Default 'primary'.
2565+
* include 'primary', 'small', 'compact' and 'large'. Default 'primary'.
25662566
* @param string $name Optional. The HTML name of the submit button. If no `id` attribute
25672567
* is given in the `$other_attributes` parameter, `$name` will be used
25682568
* as the button's `id`. Default 'submit'.
@@ -2586,7 +2586,7 @@ function submit_button( $text = '', $type = 'primary', $name = 'submit', $wrap =
25862586
*
25872587
* @param string $text Optional. The text of the button. Defaults to 'Save Changes'.
25882588
* @param string $type Optional. The type and CSS class(es) of the button. Core values
2589-
* include 'primary', 'small', and 'large'. Default 'primary large'.
2589+
* include 'primary', 'small', 'compact' and 'large'. Default 'primary large'.
25902590
* @param string $name Optional. The HTML name of the submit button. If no `id` attribute
25912591
* is given in the `$other_attributes` parameter, `$name` will be used
25922592
* as the button's `id`. Default 'submit'.
@@ -2605,7 +2605,7 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
26052605
$type = explode( ' ', $type );
26062606
}
26072607

2608-
$button_shorthand = array( 'primary', 'small', 'large' );
2608+
$button_shorthand = array( 'primary', 'small', 'large', 'compact' );
26092609
$classes = array( 'button' );
26102610

26112611
foreach ( $type as $t ) {

tests/phpunit/tests/admin/includesTemplate.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,4 +510,41 @@ public function test_get_post_states_with_null_returns_empty_array() {
510510
$result = get_post_states( null );
511511
$this->assertSame( array(), $result, 'get_post_states() should return an empty array when WP_Post is not supplied.' );
512512
}
513+
514+
/**
515+
* Tests that get_submit_button() expands the type shorthands into their
516+
* `button-*` classes.
517+
*
518+
* @ticket 64892
519+
*
520+
* @covers ::get_submit_button
521+
*
522+
* @dataProvider data_get_submit_button_shorthand
523+
*
524+
* @param string|array $type The type argument passed to get_submit_button().
525+
* @param string $expected The expected class attribute value.
526+
*/
527+
public function test_get_submit_button_expands_type_shorthands( $type, $expected ) {
528+
$button = get_submit_button( 'Save', $type, 'submit', false );
529+
530+
$this->assertStringContainsString( 'class="' . $expected . '"', $button );
531+
}
532+
533+
/**
534+
* Data provider.
535+
*
536+
* @return array[]
537+
*/
538+
public function data_get_submit_button_shorthand() {
539+
return array(
540+
'primary shorthand' => array( 'primary', 'button button-primary' ),
541+
'small shorthand' => array( 'small', 'button button-small' ),
542+
'large shorthand' => array( 'large', 'button button-large' ),
543+
'compact shorthand' => array( 'compact', 'button button-compact' ),
544+
'multiple shorthands' => array( 'primary compact', 'button button-primary button-compact' ),
545+
'non-shorthand with compact' => array( 'action compact', 'button action button-compact' ),
546+
'array type with compact' => array( array( 'primary', 'compact' ), 'button button-primary button-compact' ),
547+
'raw button-compact unchanged' => array( 'button-compact', 'button button-compact' ),
548+
);
549+
}
513550
}

0 commit comments

Comments
 (0)