new ThemesSection(id, options)
wp.customize.ThemesSection
Custom section for themes that loads themes by category, and also
handles the theme-details view rendering and navigation.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | ID. |
options |
object | Options. |
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
Extends
Methods
-
<private> _animateChangeExpanded(completeCallback)
-
Animate container state change if transitions are supported by the browser.
Parameters:
Name Type Description completeCallback
function Function to be called after transition is completed. - Since:
-
- 4.7.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
_children(parentType, childType)
-
Get the child models associated with this parent, sorting them by their priority Value.
Parameters:
Name Type Description parentType
String childType
String - Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
- Type
- Array
-
_toggleActive(active [, params])
-
Parameters:
Name Type Argument Description active
Boolean params
Object <optional>
- Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
False if state already applied.- Type
- Boolean
-
_toggleExpanded(expanded [, params])
-
Handle the toggle logic for expand/collapse.
Parameters:
Name Type Argument Description expanded
Boolean The new state to apply. params
Object <optional>
Object containing options for expand/collapse. Properties
Name Type Argument Description completeCallback
function <optional>
Function to call when expansion/collapse is complete. - Inherited From:
- Source:
Returns:
False if state already applied or active state is false.- Type
- Boolean
-
activate( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already active.- Type
- Boolean
-
attachEvents()
-
Attach events.
- Since:
-
- 4.2.0
- Overrides:
- Source:
Returns:
- Type
- void
-
checkTerm(section)
-
Event handler for search input that determines if the terms have changed and loads new controls as needed.
Parameters:
Name Type Description section
wp.customize.ThemesSection The current theme section, passed through the debouncer. - Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
closeDetails()
-
Close the theme details modal.
- Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void
-
collapse( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already collapsed.- Type
- Boolean
-
containFocus(el)
-
Keep tab focus within the theme details modal.
Parameters:
Name Type Description el
jQuery Element to contain focus. - Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void
-
controls()
-
Get the controls that are associated with this section, sorted by their priority Value.
- Since:
-
- 4.1.0
- Inherited From:
- Source:
Returns:
- Type
- Array
-
deactivate( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already inactive.- Type
- Boolean
-
embed()
-
Embed the section in the DOM when the themes panel is ready. Insert the section before the themes container. Assume that a themes section is within a panel, but not necessarily the themes panel.
- Since:
-
- 4.9.0
- Overrides:
- Source:
-
expand( [params])
-
Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
- Source:
Returns:
False if already expanded or if inactive.- Type
- Boolean
-
filtersChecked()
-
Check for filters checked in the feature filter list and initialize a new query.
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
filterSearch(term)
-
Event handler for search input that filters visible controls.
Parameters:
Name Type Description term
string The raw search input value. - Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
getContainer()
-
Return the container html, generated from its JS template, if it exists.
- Since:
-
- 4.3.0
- Inherited From:
- Source:
-
getContent()
-
Return the section's content element without detaching from the parent.
- Since:
-
- 4.9.0
- Overrides:
- Source:
Returns:
- Type
- jQuery
-
getNextTheme()
-
Get the next theme model.
- Since:
-
- 4.2.0
- Source:
Returns:
Next theme.- Type
- wp.customize.ThemeControl | boolean
-
getNotificationsContainerElement()
-
Get the element that will contain the notifications.
- Since:
-
- 4.9.0
- Inherited From:
- Source:
Returns:
Notification container element.- Type
- jQuery
-
getPreviousTheme()
-
Get the previous theme model.
- Since:
-
- 4.2.0
- Source:
Returns:
Previous theme.- Type
- wp.customize.ThemeControl | boolean
-
getVisibleCount()
-
Get visible count.
- Since:
-
- 4.9.0
- Source:
Returns:
Visible count.- Type
- int
-
initializeNewQuery(newTerm, newTags)
-
Reset the current query and load new results.
Parameters:
Name Type Description newTerm
string New term. newTags
Array New tags. - Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
isContextuallyActive()
-
Override Section.isContextuallyActive method. Ignore the active states' of the contained theme controls, and just use the section's own active state instead. This prevents empty search results for theme sections from causing the section to become inactive.
- Since:
-
- 4.2.0
- Overrides:
- Source:
Returns:
- Type
- Boolean
-
loadControls(themes, page)
-
Loads controls into the section from data received from loadThemes().
Parameters:
Name Type Description themes
Array Array of theme data to create controls with. page
integer Page of results being loaded. - Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
loadMore()
-
Determines whether more themes should be loaded, and loads them.
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
loadThemePreview(themeId)
-
Load theme preview.
Parameters:
Name Type Description themeId
string Theme ID. - Since:
-
- 4.7.0
- Deprecated:
-
- Yes
- Source:
Returns:
Promise.- Type
- jQuery.promise
-
loadThemes()
-
Load theme data via Ajax and add themes to the section as controls.
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
nextTheme()
-
Advance the modal to the next theme.
- Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void
-
onChangeActive(active [, args])
-
Active state change handler. Shows the container if it is active, hides it if not. To override by subclass, update the container's UI to reflect the provided active state.
Parameters:
Name Type Argument Description active
boolean The active state to transiution to. args
Object <optional>
Args. Properties
Name Type Argument Description duration
Object <optional>
The duration for the slideUp/slideDown animation. unchanged
boolean <optional>
Whether the state is already known to not be changed, and so short-circuit with calling completeCallback early. completeCallback
function <optional>
Function to call when the slideUp/slideDown has completed. - Since:
-
- 4.1.0
- Inherited From:
- Source:
-
onChangeExpanded(expanded, args)
-
Update UI to reflect expanded state
Parameters:
Name Type Description expanded
Boolean args
Object Properties
Name Type Description unchanged
Boolean completeCallback
function - Since:
-
- 4.2.0
- Overrides:
- Source:
Returns:
- Type
- void
-
previousTheme()
-
Advance the modal to the previous theme.
- Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void
-
ready()
-
Set up.
- Since:
-
- 4.2.0
- Overrides:
- Source:
Returns:
- Type
- void
-
renderScreenshots()
-
Render control's screenshot if the control comes into view.
- Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void
-
setupNotifications()
-
Set up notifications.
- Since:
-
- 4.9.0
- Inherited From:
- Source:
Returns:
- Type
- void
-
showDetails(theme [, callback])
-
Render & show the theme details for a given theme model.
Parameters:
Name Type Argument Description theme
object Theme. callback
function <optional>
Callback once the details have been shown. - Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void
-
updateCount()
-
Update the number of themes in the section.
- Since:
-
- 4.9.0
- Source:
Returns:
- Type
- void
-
updateLimits()
-
Disable buttons when we're viewing the first or last theme.
- Since:
-
- 4.2.0
- Source:
Returns:
- Type
- void