? Success

User tests: Successful: Unsuccessful:

avatar degobbis
degobbis
15 Sep 2015

without array-index "success" this message output create a PHP-Notice "undefined index on..."

avatar degobbis degobbis - open - 15 Sep 2015
avatar degobbis degobbis - change - 15 Sep 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Sep 2015
Labels Added: ?
avatar Bakual
Bakual - comment - 15 Sep 2015

There is no "success" message type. See https://docs.joomla.org/Display_error_messages_and_notices
There are

  • warning
  • notice
  • error
  • message (or empty)

closing as this is an issue of the extension in question and not from core.

avatar Bakual Bakual - change - 15 Sep 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-09-15 08:13:07
Closed_By Bakual
avatar Bakual Bakual - close - 15 Sep 2015
avatar Bakual Bakual - close - 15 Sep 2015
avatar degobbis
degobbis - comment - 15 Sep 2015

Since Joomla! 3 uses bootstraped templates, the messages will use the standard bootstrap CSS styles for Alerts.
https://docs.joomla.org/Display_error_messages_and_notices#Joomla.21_3.x_is_bootstrapped

If I like a green (success) output for my message, at first I look in Joomla! core output (/layout/joomla/system/message.php). If I use "message" the standard Joomla! output for messagebox is yellow (Notice), I like green. To handle this my code must be "success" a message type for the right output.

Now, if you like to reconfigure this in an override, best practice will be to rewrite the standard at first.
In Bootstrap 2 this will be

  • alert-info for blue
  • alert-warning for yellow (default)
  • alert-error for red
  • alert-success for green

If someone else uses an other template, without your override, the only possibility to get a green messagebox is to set my message type basicly to "success"

Finaly, this protostar override couses an PHP-Notice.

avatar Bakual
Bakual - comment - 15 Sep 2015

I don't say we should not fix the notice, but this PR is the wrong approach. It comes from the fact that the extension uses a "custom" type for the enqueueMessage method.

What you should instead do is check if the key exists in the $alert array and if not just use the type directly. Something like
<div class="alert <?php echo isset($alert[$type]) ? $alert[$type] : 'alert-' . $type; ?>">

avatar degobbis
degobbis - comment - 15 Sep 2015

ok, is the better way to fix this notice :-)

avatar degobbis degobbis - head_ref_deleted - 15 Sep 2015
avatar Bakual
Bakual - comment - 15 Sep 2015

See #7892

Add a Comment

Login with GitHub to post a comment