-
<private> _attach(selector, views, options)
-
Attaches a series of views to a selector. Internal.
Checks to see if a matching selector exists, renders the views,
performs the proper DOM operation, and then checks if the view is
attached to the document.
Parameters:
Name |
Type |
Description |
selector |
string
|
A jQuery selector. |
views |
Array
|
Object
|
The subviews for the main view. |
options |
Object
|
Options for call.
Properties
Name |
Type |
Description |
add |
boolean
|
If true the provided views will be added. |
|
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
<private> _isReady()
-
Determines whether or not the current view is in the DOM.
- Since:
-
- Source:
-
Returns:
Whether or not the current view is in the DOM.
-
Type
-
boolean
-
add(selector, views, options)
-
Add subview(s) to existing subviews.
An alias to `Views.set()`, which defaults `options.add` to true.
Adds any number of `views` to a `selector`.
When no `selector` is provided, the root selector (the empty string)
is used. `views` accepts a `Backbone.View` instance or an array of
`Backbone.View` instances.
Uses `Views.set()` when setting `options.add` to `false`.
Accepts an `options` object. By default, provided `views` will be
inserted at the end of the array of existing views. To insert
`views` at a specific index, use `options.at`. If `options.silent`
is true, no DOM modifications will be made.
For more information on the `options` object, see `Views.set()`.
Parameters:
Name |
Type |
Description |
selector |
string
|
A jQuery selector. |
views |
Array
|
Object
|
The subviews for the main view. |
options |
Object
|
Options for call. To insert `views` at a
specific index, use `options.at`. If
`options.silent` is true, no DOM modifications
will be made. |
- Since:
-
- Source:
-
Returns:
The current subviews instance.
-
Type
-
wp.Backbone.Subviews
-
-
Triggers widget updates via AJAX.
Parameters:
Name |
Type |
Description |
el |
string
|
Optional. Widget to fetch or none to update all. |
- Since:
-
- Source:
-
Returns:
-
Type
-
void
-
all()
-
Fetches all of the subviews.
- Since:
-
- Source:
-
Returns:
All the subviews.
-
Type
-
Array
-
array_unique_noempty(array)
-
Filters unique items and returns a new array.
Filters all items from an array into a new array containing only the unique
items. This also excludes whitespace or empty values.
Parameters:
Name |
Type |
Description |
array |
Array
|
The array to filter through. |
- Since:
-
- Source:
-
Returns:
A new array containing only the unique items.
-
Type
-
Array
-
clearFilters()
-
Clears all the checked filters.
- Source:
-
-
detach()
-
Detaches all subviews.
Helps to preserve all subview events when re-rendering the master
view. Used in conjunction with `Views.render()`.
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
editPermalink()
-
Handle the editing of the post_name. Create the required HTML elements and
update the changes via AJAX.
- Source:
-
Returns:
-
Type
-
void
-
filtersChecked()
-
Get the checked filters.
- Source:
-
Returns:
of tags or false
-
Type
-
array
-
first(selector)
-
Fetches the first subview that matches a given `selector`.
If no `selector` is provided, it will grab the first subview attached to the
view's root.
Useful when a selector only has one subview at a time.
Parameters:
Name |
Type |
Description |
selector |
string
|
A jQuery selector. |
- Since:
-
- Source:
-
Returns:
The view.
-
Type
-
Backbone.View
-
get(selector)
-
Fetches all subviews that match a given `selector`.
If no `selector` is provided, it will grab all subviews attached
to the view's root.
Parameters:
Name |
Type |
Description |
selector |
string
|
A jQuery selector. |
- Since:
-
- Source:
-
Returns:
All the subviews that match the selector.
-
Type
-
Array
-
insert($target, els, options)
-
Insert subviews into a selector.
By default, appends the subview `els` to the end of the `$target`
selector. If `options.at` is set, inserts the subview `els` at the
provided index.
Can be overridden in subclasses.
Parameters:
Name |
Type |
Argument |
Description |
$target |
string
|
|
Selector where to put the elements. |
els |
*
|
|
HTML or elements to put at the end of the
$target. |
options |
Object
|
<nullable>
|
Options for call.
Properties
Name |
Type |
Argument |
Description |
at |
number
|
<nullable>
|
At which index to put the elements. |
|
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
out()
-
Closes the submenu when no longer hovering the menu item.
- Source:
-
Returns:
-
Type
-
void
-
over()
-
Opens the submenu when hovered over the menu item for desktops.
- Source:
-
Returns:
-
Type
-
void
-
prepare()
-
Returns the options for this view.
- Since:
-
- Source:
-
Returns:
The options for this view.
-
Type
-
Object
-
quickPressLoad()
-
Control the Quick Press (Quick Draft) widget.
- Since:
-
- Source:
-
Returns:
-
Type
-
void
-
ready()
-
Triggers the ready event.
Only use this method if you know what you're doing. For performance reasons,
this method does not check if the view is actually attached to the DOM. It's
taking your word for it.
Fires the ready event on the current view and all attached subviews.
- Since:
-
- Source:
-
-
ready()
-
Method that is called when the ready event is triggered.
- Since:
-
- Source:
-
-
remove(options)
-
Removes all subviews.
Triggers the `remove()` method on all subviews. Detaches the master
view from its parent. Resets the internals of the views manager.
Accepts an `options` object. If `options.silent` is set, `unset`
will *not* be triggered on the master view's parent.
Parameters:
Name |
Type |
Description |
options |
Object
|
Options for call.
Properties
Name |
Type |
Description |
silent |
boolean
|
If true, `unset` wil *not* be triggered on
the master views' parent. |
|
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
remove()
-
Removes this view and all subviews.
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
render()
-
Renders all subviews.
Used in conjunction with `Views.detach()`.
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
render()
-
Renders this view and all subviews.
- Since:
-
- Source:
-
Returns:
The current instance of the view.
-
Type
-
wp.Backbone.View
-
replace($target, els)
-
Replaces a selector's subviews
By default, sets the `$target` selector's html to the subview `els`.
Can be overridden in subclasses.
Parameters:
Name |
Type |
Description |
$target |
string
|
Selector where to put the elements. |
els |
*
|
HTML or elements to put into the selector's HTML. |
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
search()
-
Performs a search within the collection.
- Source:
-
-
send_to_editor(html)
-
Sends the HTML passed in the parameters to TinyMCE.
Parameters:
Name |
Type |
Description |
html |
string
|
The HTML to be sent to the editor. |
- Since:
-
- Source:
-
Returns:
Returns false when both TinyMCE and QTags instances
are unavailable. This means that the HTML was not
sent to the editor.
-
Type
-
void
|
boolean
-
set(selector, views, options)
-
Registers subview(s).
Registers any number of `views` to a `selector`.
When no `selector` is provided, the root selector (the empty string)
is used. `views` accepts a `Backbone.View` instance or an array of
`Backbone.View` instances.
---
Accepts an `options` object, which has a significant effect on the
resulting behavior.
`options.silent` - *boolean, `false`*
If `options.silent` is true, no DOM modifications will be made.
`options.add` - *boolean, `false`*
Use `Views.add()` as a shortcut for setting `options.add` to true.
By default, the provided `views` will replace any existing views
associated with the selector. If `options.add` is true, the provided
`views` will be added to the existing views.
`options.at` - *integer, `undefined`*
When adding, to insert `views` at a specific index, use `options.at`.
By default, `views` are added to the end of the array.
Parameters:
Name |
Type |
Description |
selector |
string
|
A jQuery selector. |
views |
Array
|
Object
|
The subviews for the main view. |
options |
Object
|
Options for call. If `options.silent` is true,
no DOM modifications will be made. Use
`Views.add()` as a shortcut for setting
`options.add` to true. If `options.add` is
true, the provided `views` will be added to
the existing views. When adding, to insert
`views` at a specific index, use `options.at`. |
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
-
Initializes the comments list.
- Since:
-
- Source:
-
Returns:
-
Type
-
void
-
tb_position()
-
Recalculates and applies the new ThickBox position based on the current
window size.
- Since:
-
- Source:
-
Returns:
Array containing jQuery objects for all the found
ThickBox anchors.
-
Type
-
Array:.<Object:>
-
unset(selector, views, options)
-
Removes an added subview.
Stops tracking `views` registered to a `selector`. If no `views` are
set, then all of the `selector`'s subviews will be unregistered and
removed.
Accepts an `options` object. If `options.silent` is set, `remove`
will *not* be triggered on the unregistered views.
Parameters:
Name |
Type |
Description |
selector |
string
|
A jQuery selector. |
views |
Array
|
Object
|
The subviews for the main view. |
options |
Object
|
Options for call. If `options.silent` is set,
`remove` will *not* be triggered on the
unregistered views. |
- Since:
-
- Source:
-
Returns:
The current Subviews instance.
-
Type
-
wp.Backbone.Subviews
-
uploader()
-
When users press the "Upload Theme" button, show the upload form in place.
- Source:
-
-
WPRemoveThumbnail(nonce)
-
Remove the Featured Image
Parameters:
Name |
Type |
Description |
nonce |
string
|
Nonce to use in the request. |
- Source:
-
-
WPSetThumbnailHTML(html)
-
Overwrite the content of the Featured Image postbox
Parameters:
Name |
Type |
Description |
html |
string
|
New HTML to be displayed in the content area of the postbox. |
- Source:
-
-
WPSetThumbnailID(id)
-
Set the Image ID of the Featured Image
Parameters:
Name |
Type |
Description |
id |
int
|
The post_id of the image to use as Featured Image. |
- Source:
-
-
wptitlehint(id)
-
Adds screen reader text to the title label when needed.
Use the 'screen-reader-text' class to emulate a placeholder attribute
and hide the label when entering a value.
Parameters:
Name |
Type |
Description |
id |
string
|
Optional. HTML ID to add the screen reader helper text to. |
- Source:
-
Returns:
-
Type
-
void