Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 5 weeks ago

#39930 closed task (blessed) (fixed)

Adding documentation for wp.customize properties

Reported by: shramee Owned by: westonruter
Priority: normal Milestone: 4.9
Component: Customize Version: 4.8
Severity: normal Keywords: has-patch needs-docs
Cc: Focuses: javascript, docs

Description

Adding documentation for...

  • wp.customize.control
  • wp.customize.section
  • wp.customize.panel

Along with examples for usage.

Attachments (2)

39930.patch​ (2.0 KB ) - added by shramee 10 years ago.
Patch for docs
39930-1.patch​ (2.5 KB ) - added by shramee 10 years ago.
Second patch for docs

Download all attachments as: .zip

Change History (17)

@shramee
10 years ago

Patch for docs

This ticket was mentioned in ​Slack in #docs by shramee. ​View the logs.


10 years ago

#2 @westonruter
10 years ago

  • Milestone Awaiting Review → 4.8

Thanks. I wouldn't mention _values as it is private. The items in the collection should only be accessed via the methods on Values like each().

Also, instead of @return {object|undefined} these should have @returns {wp.customize.Section|undefined} according to the various types.

Also a key example to include is how to use the deferred pattern, for example:

wp.customize.section( 'title_tagline', function( section ) { section.expand(); } )

The deferred pattern is preferred since it ensures there is no JS error in the case of something not being registered.

#3 @shramee
10 years ago

  • Focuses docs added
  • Keywords has-patch needs-docs added

#4 @shramee
10 years ago

Aye, Agree @westonruter,

Adding a new patch ;)

@shramee
10 years ago

Second patch for docs

#5 @shramee
10 years ago

@westonruter Thanks a lot, I am using this in one of my plugin (will be live on wp.org soon).
Passing a deferred (anonymous) function would make my plugin more robust :)

PFA 39930-1.patch

Last edited 10 years ago by shramee (previous) (diff)

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


9 years ago

#7 @jbpaul17
9 years ago

  • Milestone 4.8 → 4.8.1

Per yesterday's bug scrub, we're going to punt this to 4.8.1.

#8 @westonruter
9 years ago

  • Milestone 4.8.1 → 4.9

#9 @DrewAPicture
9 years ago

  • Focuses javascript added

This ticket was mentioned in ​Slack in #core-customize by jeffpaul. ​View the logs.


9 years ago

#11 @jbpaul17
9 years ago

  • Type enhancement → task (blessed)

As this is a documentation update, we'll switch this from an enhancement to a task ticket type.

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


9 years ago

#13 @westonruter
9 years ago

  • Owner set to westonruter
  • Status new → accepted

#14 @westonruter
9 years ago

  • Resolution → fixed
  • Status accepted → closed

In 41799:

Customize: Add jsdoc for api.panel, api.section, api.control, and api.notifications collections.

Props shramee, westonruter.
Fixes #39930.

#15 @westonruter
5 weeks ago

In 63455:

Customize: Correct the JSDoc for the controls API.

Many of the types named nothing that resolves. The four deferred getters referred to their callback typedefs without a namespace, the promise they return was spelled jQuery.promise, which is neither the capitalization the namespace is declared under nor the name of a type, and jQuery events were typed as plain objects.

Two blocks documented the wrong thing outright. ThemesPanel lent its prototype to a name misspelled without the second e, so its methods were attached to a namespace that exists nowhere else, and getInitialHeaderImage() carried the return of the method beside it, describing a set of cropper options where its own summary already said it returns a model.

Parameters the code treats as optional are marked as such.

Developed as subset of ​https://github.com/WordPress/wordpress-develop/pull/10743.
Follow-up to r41799, r48650, r63454.

Props westonruter, afercia.
See #39671, #39930, #40831, #64662, #66033.

Note: See TracTickets for help on using tickets.