[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Document\Renderer\Html; 11 12 use Joomla\CMS\Document\DocumentRenderer; 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Layout\LayoutHelper; 15 16 // phpcs:disable PSR1.Files.SideEffects 17 \defined('JPATH_PLATFORM') or die; 18 // phpcs:enable PSR1.Files.SideEffects 19 20 /** 21 * HTML document renderer for the system message queue 22 * 23 * @since 3.5 24 */ 25 class MessageRenderer extends DocumentRenderer 26 { 27 /** 28 * Renders the error stack and returns the results as a string 29 * 30 * @param string $name Not used. 31 * @param array $params Associative array of values 32 * @param string $content Not used. 33 * 34 * @return string The output of the script 35 * 36 * @since 3.5 37 */ 38 public function render($name, $params = array(), $content = null) 39 { 40 $msgList = $this->getData(); 41 $displayData = array( 42 'msgList' => $msgList, 43 'name' => $name, 44 'params' => $params, 45 'content' => $content, 46 ); 47 48 $app = Factory::getApplication(); 49 $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/message.php'; 50 51 if (is_file($chromePath)) { 52 include_once $chromePath; 53 } 54 55 if (\function_exists('renderMessage')) { 56 @trigger_error( 57 'renderMessage() is deprecated. Override system message rendering with layouts instead.', 58 E_USER_DEPRECATED 59 ); 60 61 return renderMessage($msgList); 62 } 63 64 return LayoutHelper::render('joomla.system.message', $displayData); 65 } 66 67 /** 68 * Get and prepare system message data for output 69 * 70 * @return array An array contains system message 71 * 72 * @since 3.5 73 */ 74 private function getData() 75 { 76 // Initialise variables. 77 $lists = array(); 78 79 // Get the message queue 80 $messages = Factory::getApplication()->getMessageQueue(); 81 82 // Build the sorted message list 83 if (\is_array($messages) && !empty($messages)) { 84 foreach ($messages as $msg) { 85 if (isset($msg['type']) && isset($msg['message'])) { 86 $lists[$msg['type']][] = $msg['message']; 87 } 88 } 89 } 90 91 return $lists; 92 } 93 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |