magento-hackathon / magento2-toolbar

Toolbar with developer and merchant functionality
Open Software License 3.0
28 stars 7 forks source link

Add toolbar() helper function #12

Closed barryvdh closed 6 years ago

barryvdh commented 8 years ago

So this might raise a few red flags, because I think the static call to the ObjectManager is discouraged, but this adds a small helper for development only, to easily add a message.

toolbar(); // The Toolbar instance
toolbar($object); // Add $object to the messages
toolbar($object, $string, $other); // Add multiple items to the message collector

Obviously this isn't for 3rd party modules or something, but more as developer, you might want to check the result before/after some call, without interrupting the output. And injecting the Toolbar for just a quick check is much more cumbersome then calling a global function..

(Could also add more convenient functions like start/stop measurements, to experiment with timing)

barryvdh commented 8 years ago

BTW, a nice side-effect of having the debugbar, which uses symfony var-dumper, is being able to call dump($object) already, without crashing your browser like var_dump() ;)