how to figure out where the hook is launched


  • GNU/Linux

    Suppose to have this hook:

    "hook": "filter:topics.get", "method": "orderTopics"
    

    I know that when the hook is called the method is execute, but I don't want always execute the method. For some url like this:

    /station

    I don't want that the hook is throwed and I want specify this in the method:

    //server side library.js
    converter.orderTopics = function(data, callback) {
    //Something like this
    
    var url_station=url.getUrl() // give me the current url 
    
    }
    

    Anyone can help me?


  • Admin

    filter:topics.get does not provide that data, you can probably use one of the page build hooks like filter:category.build filter:recent.build etc. each page has one and it provides alot more data including the url.


Log in to reply
 


Star

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.