[ 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) 2012 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\HTML\Helpers; 11 12 use Joomla\CMS\Factory; 13 use Joomla\CMS\HTML\HTMLHelper; 14 use Joomla\CMS\Layout\FileLayout; 15 16 // phpcs:disable PSR1.Files.SideEffects 17 \defined('JPATH_PLATFORM') or die; 18 // phpcs:enable PSR1.Files.SideEffects 19 20 /** 21 * Utility class for icons. 22 * 23 * @since 2.5 24 */ 25 abstract class Icons 26 { 27 /** 28 * Method to generate html code for a list of buttons 29 * 30 * @param array $buttons Array of buttons 31 * 32 * @return string 33 * 34 * @since 2.5 35 */ 36 public static function buttons($buttons) 37 { 38 if (empty($buttons)) { 39 return ''; 40 } 41 42 $html = array(); 43 44 foreach ($buttons as $button) { 45 $html[] = HTMLHelper::_('icons.button', $button); 46 } 47 48 return implode($html); 49 } 50 51 /** 52 * Method to generate html code for a list of buttons 53 * 54 * @param array $button Button properties 55 * 56 * @return string 57 * 58 * @since 2.5 59 */ 60 public static function button($button) 61 { 62 if (isset($button['access'])) { 63 if (is_bool($button['access'])) { 64 if ($button['access'] == false) { 65 return ''; 66 } 67 } else { 68 // Get the user object to verify permissions 69 $user = Factory::getUser(); 70 71 // Take each pair of permission, context values. 72 for ($i = 0, $n = count($button['access']); $i < $n; $i += 2) { 73 if (!$user->authorise($button['access'][$i], $button['access'][$i + 1])) { 74 return ''; 75 } 76 } 77 } 78 } 79 80 // Instantiate a new FileLayout instance and render the layout 81 $layout = new FileLayout('joomla.quickicons.icon'); 82 83 return $layout->render($button); 84 } 85 }
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 |