image_attachment_fields_to_edit

Definition:
function image_attachment_fields_to_edit($form_fields, $post) {}

Parameters

  • unknown_type $form_fields
  • unknown_type $post

Source code

function image_attachment_fields_to_edit($form_fields, $post) {

	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {

		$alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);

		if ( empty($alt) )

			$alt = '';



		$form_fields['post_title']['required'] = true;



		$form_fields['image_alt'] = array(

			'value' => $alt,

			'label' => __('Alternate Text'),

			'helps' => __('Alt text for the image, e.g. “The Mona Lisa”')

		);



		$form_fields['align'] = array(

			'label' => __('Alignment'),

			'input' => 'html',

			'html'  => image_align_input_fields($post, get_option('image_default_align')),

		);



		$form_fields['image-size'] = image_size_input_fields( $post, get_option('image_default_size', 'medium') );



	} else {

		unset( $form_fields['image_alt'] );

	}

	return $form_fields;

}

1979

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: