WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 3 weeks ago

#38734 assigned enhancement

Dogfood the Settings API

Reported by: johnbillion Owned by: johnbillion
Milestone: Future Release Priority: normal
Severity: normal Version: 2.7
Component: Options, Meta APIs Keywords: needs-patch settings-api
Focuses: accessibility, administration Cc:

Description

WordPress has had a Settings API for eight years, but the core settings screens in WordPress don't use it. Instead, these screens use hardcoded sections and fields, which means it's impossible for a plugin to remove sections or fields without removing the entire screen.

There's a new Fields API in development but this doesn't mean the core settings screens shouldn't be improved in the meantime by switching to the Settings API.

I think the best approach for this is to address one screen at a time, starting with General Settings, and go from there.

If anyone thinks this change should not be made, speak now or forever hold your peace.

Related: #9296, #15691, #18801, #32396

Attachments (2)

38734.diff (33.0 KB) - added by johnbillion 8 months ago.
38734.2.diff (32.7 KB) - added by afercia 8 months ago.

Download all attachments as: .zip

Change History (19)

#1 @afercia
9 months ago

  • Keywords settings-api added

#2 follow-up: @sc0ttkclark
9 months ago

This would significantly help us in our work with the Fields API by the way, there are certain settings fields on these screens which are not easily reproduced with the normal Settings API sections > fields structure as currently built.

#3 in reply to: ↑ 2 @afercia
9 months ago

  • Focuses accessibility added

Replying to sc0ttkclark:

by the way, there are certain settings fields on these screens which are not easily reproduced with the normal Settings API sections > fields structure

It would be a very good opportunity to simplify some of the settings controls :) see for example #31354 and #31356

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


8 months ago

#5 @afercia
8 months ago

  • Milestone changed from Awaiting Review to 4.8

Discussed in today's weekly accessibility bug-scrub and we'd like to try to do this for at least the General Settings page for 4.8.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


8 months ago

#7 @afercia
8 months ago

Related (and closed as "maybelater"): #18285 perhaps the most interesting discussion about the Settings API is there.

#8 @rianrietveld
8 months ago

  • Owner set to rianrietveld
  • Status changed from new to assigned

#9 @johnbillion
8 months ago

  • Owner changed from rianrietveld to johnbillion

@johnbillion
8 months ago

#10 @johnbillion
8 months ago

38734.diff is an MVP (minimum viable patch) which does the following for the General Settings screen:

  • Registers all of the settings.
  • Registers fields for each of the existing settings table rows.
  • Migrates all the hardcoded fields into settings fields.

TODO: Replace all the new procedural functions with a nice class per settings screen (eg. WP_Settings_General) with a method for each field and setting.

@afercia
8 months ago

#11 @afercia
8 months ago

Noticed there are (also in the current options-general.php) a couple misplaced <span> elements and just thought to fix them. No other changes in the refreshed patch.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


7 months ago

This ticket was mentioned in Slack in #accessibility by sc0ttkclark. View the logs.


7 months ago

This ticket was mentioned in Slack in #core by johnbillion. View the logs.


6 months ago

This ticket was mentioned in Slack in #core by afercia. View the logs.


4 months ago

#16 @afercia
3 months ago

  • Milestone changed from 4.8 to Future Release

Punting as we're running out of time for the 4.8 release.

This ticket was mentioned in Slack in #core by afercia. View the logs.


3 weeks ago

Note: See TracTickets for help on using tickets.