This PR proposes a better fix than #7884
Issue
If an extension uses a custom message type in the enqueueMessage($message, $type) method, then it will currently show a notice:
Notice: Undefined index: foo in ...\templates\protostar\html\layouts\joomla\system\message.php`
Solution
Check first if the array key is set before calling it. If not set, just use the $type directly.
Testing
Simplest is to just add the following line to the start of the index.php of the template:
JFactory::getApplication()->enqueueMessage('test', 'success');
(should create a green message)
or
JFactory::getApplication()->enqueueMessage('test', 'foo');
(should create a orange message)
Note
The Isis template uses the same JLayout, so I changed it there as well.
Tested successful. Together with the test by @degobbis I'm going to mark it RTC. Thanks @Bakual and @degobbis
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7892.