I’ve not reach that section of the code as yet so I’ll reserve all further comments on it until I’m there.
I for one like the $cms->getWidgetByName() function although I was more thinking of a $cms->getWidgetObject() function.
There will also be a $cms->getWidgetById() function that will be used to return an instance of the Widget. For example:
Consider this Button Widget:
[[Button? &_id=`btnSave` &text=`Save`]]
[[Button? &_id=`btnCancel` &text=`Cancel`]]
In your code you’ll be able to get a reference to the btnCancel button by using:
$btn = $cms->getWidgetById('btnCancel');
$btn->setProp('style','border:1px solid #c0c0c0');