public static function actions() { return array(…) }
Yes, the returning value is similar. I call it action provider. As a result, this can be any class that defines a static actions() method. An action provider can contain other providers by listing them in its actions(). So this is a recursive definition.
So in theory then widgets should provide a "prefix" attribute that they will use when encoding the url for an action. So when a developer builds a widget, if this widget includes other widgets would they need to define that widgets prefix like <com:Widget4 prefix="$this->prefix.'w4.'" /> ? or could the specify simply <com:Widget4 prefix="w4" /> and the encodeUrl method would automatically append the controllers prefix to the widgets prefix (so the action looks like w1.w4.action11 in either case) ?
So a request like "w1.w4.action11" looks up the w2's action provider actions list. which then will try to match the "w4.action11", causing it to look up w4's action provider action list which will then direct the response to "action11"
Well, you're here discussing the same thing I've asked in a neighboor topic.
This approach you came to doesn't count one aspect. It still requires to declare widget's actions in the controller as well as placing widgets in the view. Note that we have CViewController with no code behind, and this is my situation. I don't want end-user to ever see PHP code to configure his website and plug certain functionality into a view. Moreover, everything except website views will be encoded by IonCube.
The actual problem is in the controller lifecycle:
Init application
Dispatch request
Run controller
3.1. Run filters
3.2. Execute actions
3.3. Render certain view (and only here we know what widgets are used).
I offer to focus on better interaction of controller and a widget. For example, widget actions can be executed separately from controller actions. This may be implemented in CController::endWidget and CController::widget, for example.
Yes, one of the main differences between Yii and Prado is in the lifecycle. The controller won't be able to know which widgets are used until they are being rendered. While this is certainly inconvenient in some scenarios, it offers the needed performance and also makes widget development much easier. The result is that the user of the widget needs to take more responsibility (still reasonable, however).