Namespace: postboxes

postboxes

This object contains all function to handle the behaviour of the post boxes. The post boxes are the boxes you see around the content on the edit page.
Since:
  • 2.7.0
Source:

Members


<static> pbhide

Properties:
Name Type Description
pbhide function | boolean A callback that is called when a postbox is closed.
Since:
  • 2.7.0
Source:

<static> pbshow

Properties:
Name Type Description
pbshow function | boolean A callback that is called when a postbox is opened.
Since:
  • 2.7.0
Source:

Methods


<private, static> _mark_area()

Marks empty postbox areas. Adds a message to empty sortable areas on the dashboard page. Also adds a border around the side area on the post edit screen if there are no postboxes present.
Since:
  • 3.3.0
Source:
Returns:
Type
void

<private, static> _pb_change()

Changes the amount of columns the postboxes are in based on the current orientation of the browser.
Since:
  • 3.3.0
Source:
Returns:
Type
void

<private, static> _pb_edit(n)

Changes the amount of columns on the post edit page.
Parameters:
Name Type Description
n number The amount of columns to divide the post edit page in.
Since:
  • 3.3.0
Source:
Fires:
  • postboxes#event:postboxes-columnchange
Returns:
Type
void

<static> add_postbox_toggles(page [, args])

Adds event handlers to all postboxes and screen option on the current page.
Parameters:
Name Type Argument Description
page string The page we are currently on.
args Object <optional>
Properties
Name Type Description
pbshow function A callback that is called when a postbox opens.
pbhide function A callback that is called when a postbox closes.
Since:
  • 2.7.0
Source:
Returns:
Type
void

<static> handle_click()

Handles a click on either the postbox heading or the postbox open/close icon. Opens or closes the postbox. Expects `this` to equal the clicked element. Calls postboxes.pbshow if the postbox has been opened, calls postboxes.pbhide if the postbox has been closed.
Since:
  • 4.4.0
Source:
Fires:
  • postboxes#event:postbox-toggled
Returns:
Type
void

<static> init(page [, args])

Initializes all the postboxes, mainly their sortable behaviour.
Parameters:
Name Type Argument Default Description
page string The page we are currently on.
args Object <optional>
{} The arguments for the postbox initializer.
Properties
Name Type Description
pbshow function A callback that is called when a postbox opens.
pbhide function A callback that is called when a postbox closes.
Since:
  • 2.7.0
Source:
Returns:
Type
void

<static> save_order(page)

Saves the order of the postboxes to the server. Sends a list of all postboxes inside a sortable area to the server.
Parameters:
Name Type Description
page string The page we are currently on.
Since:
  • 2.8.0
Source:
Returns:
Type
void

<static> save_state(page)

Saves the state of the postboxes to the server. It sends two lists, one with all the closed postboxes, one with all the hidden postboxes.
Parameters:
Name Type Description
page string The page we are currently on.
Since:
  • 2.7.0
Source:
Returns:
Type
void