Javascript Filters

ph.api.hooks is an object that contains all the actions and filters used in the javascript on the page. For developers familiar with WordPress, they work very similar to WordPress' PHP hooks, and for developers familiar with Gutenberg, they work almost identically to Gutenberg's hooks.

You can add a new action using the following:

ph.api.hooks.addFilter( tag, namespace, callback, priority )

Here are some specific filters you can access to change/update when data is set/saved.


When javascript models (Threads, Comments, Pages, etc) are initialized, they broadcast a model initialization action. Model initializations help you hook into a specific model on a page and run or add your own functions.

Model Initialize Formula

Actions follow this formula:


Substitute any of the following for {$project_type} below:

  • mockup Mockup Project
  • website Website Project

Substitute any of the following for {$type_name} below:

  • Mockup (Mockup Project)
  • Website (Website Project)
  • WebsitePage (Website Page)
  • MockupImage (Mockup Image)
  • MockupThread (Mockup Conversation Thread)
  • WebsiteThread (Website Conversation Thread)
  • comment (Individual Comment)


Each action passes the model as a parameter:

Attribute Description
model Current model.


Here are a few examples of how this formula works:

 * Hook into website thread initialize
    // this is the comment action
    // this is your custom namespace
    // the function we're going to run

 * Hook into comment initialize
function myFunction(model) {
   // this will log the model
   // this will run a model's method
   if ( typeof model.setModerate === "function" ) {

   // this will log the comment content