[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_users 6 * 7 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Users\Administrator\Extension; 12 13 use Joomla\CMS\Component\Router\RouterServiceInterface; 14 use Joomla\CMS\Component\Router\RouterServiceTrait; 15 use Joomla\CMS\Extension\BootableExtensionInterface; 16 use Joomla\CMS\Extension\MVCComponent; 17 use Joomla\CMS\Factory; 18 use Joomla\CMS\Fields\FieldsServiceInterface; 19 use Joomla\CMS\HTML\HTMLRegistryAwareTrait; 20 use Joomla\Component\Users\Administrator\Service\HTML\Users; 21 use Psr\Container\ContainerInterface; 22 23 // phpcs:disable PSR1.Files.SideEffects 24 \defined('JPATH_PLATFORM') or die; 25 // phpcs:enable PSR1.Files.SideEffects 26 27 /** 28 * Component class for com_users 29 * 30 * @since 4.0.0 31 */ 32 class UsersComponent extends MVCComponent implements BootableExtensionInterface, RouterServiceInterface, FieldsServiceInterface 33 { 34 use RouterServiceTrait; 35 use HTMLRegistryAwareTrait; 36 37 /** 38 * Booting the extension. This is the function to set up the environment of the extension like 39 * registering new class loaders, etc. 40 * 41 * If required, some initial set up can be done from services of the container, eg. 42 * registering HTML services. 43 * 44 * @param ContainerInterface $container The container 45 * 46 * @return void 47 * 48 * @since 4.0.0 49 */ 50 public function boot(ContainerInterface $container) 51 { 52 $this->getRegistry()->register('users', new Users()); 53 } 54 55 /** 56 * Returns a valid section for the given section. If it is not valid then null is returned. 57 * 58 * @param string $section The section to get the mapping for 59 * @param object|null $item The content item or null 60 * 61 * @return string|null The new section or null 62 * 63 * @since 4.0.0 64 */ 65 public function validateSection($section, $item = null) 66 { 67 if (Factory::getApplication()->isClient('site')) { 68 switch ($section) { 69 case 'registration': 70 case 'profile': 71 return 'user'; 72 } 73 } 74 75 if ($section === 'user') { 76 return $section; 77 } 78 79 // We don't know other sections. 80 return null; 81 } 82 83 /** 84 * Returns valid contexts. 85 * 86 * @return array Associative array with contexts as keys and translated strings as values 87 * 88 * @since 4.0.0 89 */ 90 public function getContexts(): array 91 { 92 $language = Factory::getApplication()->getLanguage(); 93 $language->load('com_users', JPATH_ADMINISTRATOR); 94 95 return [ 96 'com_users.user' => $language->_('COM_USERS'), 97 ]; 98 } 99 }
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 |