This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The concrete5 Page Selector helper includes optional parameters to run your own JavaScript. But what if you need to run the original helper JavaScript followed by your own JavaScript?

$pageSelector = Loader::helper('form/page_selector');

Rather than use the parameters built in to the php of the concrete5 helper, you can subvert the global function that it uses (within a jQuery ready handler):

var redirect_old_handler = ccm_selectSitemapNode;
var redirect_new_handler = function(cID, cName) {
  redirect_old_handler (cID, cName);
  /*
   your stuff here to do things with cID and cName
  */
};
ccm_selectSitemapNode = redirect_new_handler;

What this code does is to simply:

  1. Make a note of the existing handler

  2. Define a new handler that calls the old handler

  3. Replace the existing handler with the new handler

Similar techniques can be used to work with the result of other concrete5 form widgets.

Read more How-tos by JohntheFish

Loading Conversation