What does the PF function do in Primefaces?

Jens Schauder picture Jens Schauder · May 15, 2014 · Viewed 42.3k times · Source

On many places one can find usage of a function PF with Primefaces. For example in this answer

From what I have seen so far it seems to be a magic "make it work a little better" function. But I don't believe in this kind of stuff so:

What does this function do?

And where can I find documentation about it?

Answer

Mark picture Mark · May 15, 2014

PF is a Javascript function.

In Primefaces 4.0 the Javascript scope of widgets changed. Prior to version 4.0 you could open a dialog widget with widgetVar.show();.

In Primefaces 4.0 and above the widgets are stored in a Javascript widget array. When you call PF('widgetVar') it is looking for the widget in the array and returning it.

PF=function(d){
    var c=b.widgets[d];
    if(!c){
        if(a.console&&console.log){
            console.log("Widget for var '"+d+"' not available!")
        }
        b.error("Widget for var '"+d+"' not available!")
    }
    return c
};

I could not find much on this either this is what I was able to decipher using Chrome's developer tools.