?
avatar BrainforgeUK
BrainforgeUK
5 Nov 2019

Steps to reproduce the issue

JFactory::getApplication()->enqueueMessage('My message', 'My Message Type')

Expected result

Displays
My Message Type
My Message

Actual result

Displays
my message type
My Message

System information (as much as possible)

Joomla 3.9

Additional comments

Suggest changing the function parameters to:

public function enqueueMessage($msg, $type='message', $format='strtolower')

And add a function exists check message enqueue line to:

_if (!empty($type) && function_exists($type))
{
$type = $format($type);
}
$this->messageQueue[] = array('message' => $msg, 'type' => $type);

There are other ways of getting round this, such as in the template, but this change puts the design decision into the hands of the component / module developer.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar BrainforgeUK BrainforgeUK - open - 5 Nov 2019
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Nov 2019
avatar mbabker
mbabker - comment - 5 Nov 2019

The type isn't meant to be used in this way. The type really should be a standardized value (which 4.0 provides by defining a set of message type constants that match up to the PSR-3 log levels basically), not a section heading or anything like that. Then it's up to the template to theme the message types.

avatar brianteeman
brianteeman - comment - 8 Nov 2019

As @mbabker this is not the correct use of the type and this issue should be closed (and it woun't work in j4 anyway)

avatar Quy Quy - close - 8 Nov 2019
avatar Quy Quy - change - 8 Nov 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-11-08 22:42:53
Closed_By Quy

Add a Comment

Login with GitHub to post a comment