New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"File" and "Media" settings field types are synonymous #1758

Closed
DevinWalker opened this Issue Jun 5, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@DevinWalker
Member

DevinWalker commented Jun 5, 2017

Issue Overview

Currently in the Settings Field API example there are two field types called media and file. They appear identical:

File:
2017-06-05_14-35-00
https://github.com/WordImpress/Give-Settings-API-Example/blob/master/includes/class-setting-api-fields.php#L119

Media:
2017-06-05_14-35-11
https://github.com/WordImpress/Give-Settings-API-Example/blob/master/includes/class-metabox-setting.php#L227

Expected Behavior

You should be able to use either file or media to output this field type both in options settings and metabox settings.

Current Behavior

The file field type can't be used within the metabox settings. Likewise, the media field type can't be used within the settings fields. When attempting to output the field type, nothing displays:

	// Media.
			array(
				'id'          => "test_media",
				'name'        => __( 'Media Field', 'give' ),
				'type'        => 'media',
				'description' => __( 'This is media field.', 'give' ),
			),

Possible Solution

Consolidate the two field types code and ensure both file and media types can be used within options and metabox settings.

Steps to Reproduce (for bugs)

  1. Install Give - Settings API Examples
  2. Review media and file types
  3. Try to change placement of field types from metabox to settings fields
  4. The fields will not appear

@DevinWalker DevinWalker added the bug label Jun 5, 2017

@DevinWalker DevinWalker added this to the 1.8.9 milestone Jun 5, 2017

@DevinWalker

This comment has been minimized.

Show comment
Hide comment
@DevinWalker

DevinWalker Jun 5, 2017

Member

Another Issue

I also noticed if you use the media file type within the metabox form field options you don't get the nice image preview:

No Preview (in metabox)

2017-06-05_15-00-40

With Preview (in settings)

2017-06-05_15-03-06

There should always be an image preview displayed.

Member

DevinWalker commented Jun 5, 2017

Another Issue

I also noticed if you use the media file type within the metabox form field options you don't get the nice image preview:

No Preview (in metabox)

2017-06-05_15-00-40

With Preview (in settings)

2017-06-05_15-03-06

There should always be an image preview displayed.

@ravinderk ravinderk referenced this issue Jun 6, 2017

Merged

Issue/1758 #1761

3 of 3 tasks complete

@DevinWalker DevinWalker closed this Jun 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment