Home > Article > Backend Development > There are several functions in the typecho_widget source code that are not very clear. Could you please tell me?
I recently looked at the source code of typecho_widget. This is the parent class of all widgets. There are several methods that are not very clear. Please tell me.
<code>/**</code>
post event triggered
*
@param boolean $condition trigger condition
@return mixed
*/
function on($condition)
{
<code> if ($condition) { return $this; } else { return new Typecho_Widget_Helper_Empty(); }</code>
}
It is said that it is triggered by post, so how is it triggered? I don’t see any relevant calls. The general meaning of the function is to return the current widget if the conditions are met. I hope you can enlighten me, thank you! ! !
I recently looked at the source code of typecho_widget. This is the parent class of all widgets. There are several methods that are not very clear. Please tell me.
<code>/**</code>
post event triggered
*
@param boolean $condition trigger condition
@return mixed
*/
function on($condition)
{
<code> if ($condition) { return $this; } else { return new Typecho_Widget_Helper_Empty(); }</code>
}
It is said that it is triggered by post, so how is it triggered? I don’t see any relevant calls. The general meaning of the function is to return the current widget if the conditions are met. I hope you can enlighten me, thank you! ! !
Is there anyone who can help me with the answer