wppaste
WordPress

image_align_input_fields( WP_Post $post, string $checked = '' ): string

Since
2.7.0
Source
wp-admin/includes/media.php:1153
Retrieves HTML for the image alignment radio buttons with the specified one checked.

Parameters

$postWP_Post
$checkedstringoptional
Default: ''

Return

string

Uses · 3

Used by · 1

Source

function image_align_input_fields( $post, $checked = '' ) { 	if ( empty( $checked ) ) {		$checked = get_user_setting( 'align', 'none' );	} 	$alignments = array(		'none'   => __( 'None' ),		'left'   => __( 'Left' ),		'center' => __( 'Center' ),		'right'  => __( 'Right' ),	); 	if ( ! array_key_exists( (string) $checked, $alignments ) ) {		$checked = 'none';	} 	$output = array(); 	foreach ( $alignments as $name => $label ) {		$name     = esc_attr( $name );		$output[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'" .			( $checked === $name ? " checked='checked'" : '' ) .			" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";	} 	return implode( "\n", $output );}

History

Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/media.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.