Skip to content

Commit 69668fa

Browse files
committed
[imp] deprecate JHtmlMessages::state() function
1 parent 896a591 commit 69668fa

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

administrator/components/com_messages/helpers/html/messages.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,46 @@ class JHtmlMessages
2424
* @param boolean $canChange Can the user change the state?
2525
*
2626
* @return string
27+
*
28+
* @deprecated 4.0
2729
*/
2830
public static function state($value = 0, $i = 0, $canChange = false)
2931
{
30-
// Note: $i is required but has to be an optional argument in the funtion call due to argument order
32+
// Log deprecated message
33+
JLog::add(
34+
'JHtmlMessages::state() is deprecated. Use JHtmlMessages::status() instead.',
35+
JLog::WARNING,
36+
'deprecated'
37+
);
38+
39+
// Note: $i is required but has to be an optional argument in the function call due to argument order
3140
if (null === $i)
3241
{
3342
throw new InvalidArgumentException('$i is a required argument in JHtmlMessages::state');
3443
}
3544

36-
// Note: $canChange is required but has to be an optional argument in the funtion call due to argument order
45+
// Note: $canChange is required but has to be an optional argument in the function call due to argument order
3746
if (null === $canChange)
3847
{
3948
throw new InvalidArgumentException('$canChange is a required argument in JHtmlMessages::state');
4049
}
4150

51+
return static::status($i, $value, $canChange);
52+
}
53+
54+
/**
55+
* Get the HTML code of the state switcher
56+
*
57+
* @param int $i Row number
58+
* @param int $value The state value
59+
* @param boolean $canChange Can the user change the state?
60+
*
61+
* @return string
62+
*
63+
* @since 3.4
64+
*/
65+
public static function status($i, $value = 0, $canChange = false)
66+
{
4267
// Array of image, task, title, action.
4368
$states = array(
4469
-2 => array('trash.png', 'messages.unpublish', 'JTRASHED', 'COM_MESSAGES_MARK_AS_UNREAD'),

administrator/components/com_messages/views/messages/tmpl/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<?php echo $this->escape($item->subject); ?></a>
9292
</td>
9393
<td class="center">
94-
<?php echo JHtml::_('messages.state', $item->state, $i, $canChange); ?>
94+
<?php echo JHtml::_('messages.status', $i, $item->state, $canChange); ?>
9595
</td>
9696
<td>
9797
<?php echo $item->user_from; ?>

0 commit comments

Comments
 (0)