framework/base/Widget.php
public function beforeRun()
    {
        $event = new WidgetEvent();
        $this->trigger(self::EVENT_BEFORE_RUN, $event);
        return $event->isValid;
    }
public function beforeRun()
    {
        $event = new WidgetEvent();
        $this->trigger(self::EVENT_BEFORE_RUN, $event);
        return $event->isValid;
    }
This method is invoked right before the widget is executed.

The method will trigger the [[EVENT_BEFORE_RUN]] event. The return value of the method
will determine whether the widget should continue to run.

When overriding this method, make sure you call the parent implementation like the following:

```php
public function beforeRun()
{
if (!parent::beforeRun()) {
return false;
}

// your custom code here

return true; // or false to not run the widget
}
```

@return bool whether the widget should continue to be executed.
@since 2.0.11