@@ -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 ' ),
0 commit comments