Updated 4a. JCB Demo Component Directory, Folders and Files (markdown)

Joseph Geller
2018-09-23 09:33:17 -05:00
parent 9c13149529
commit 29fb5e0311

@@ -323,15 +323,13 @@ Target (array) $items values *
## [JCB - Editing the Site View](http://localhost/demo/administrator/index.php?option=com_componentbuilder&view=dynamic_get&layout=edit&id=36) ## [JCB - Editing the Site View](http://localhost/demo/administrator/index.php?option=com_componentbuilder&view=dynamic_get&layout=edit&id=36)
Some below and previously may be outdated. For example, the Joomla! Platform documentation is no longer maintained and Platform 14 is outdated plus obsolete and the Joomla! 2.5 API Index may also appear. It is in the links since it has not been removed from current Joomla! documentation; many classes in use have early origins as stated in the documentation. Joomla! has some extensive changes though involving namespaces with Joomla! 4 which relies on it heavily. Locations of class files vary by release, made a bit more elusive with Joomla! 4 name space changes. But their is current backwards compatibility and hence alias list do exist as we shall see next. Some of the links below and seen previously in this document may be outdated. For example, the Joomla! Platform documentation is no longer maintained; and Platform 14 is outdated besides being obsolete. The Joomla! 2.5 API Index may also appear in some of the links. They have not been removed from current Joomla! documentation; many classes in use have early origins and stated as such in the documentation. Joomla! has extensive changes involving namespaces with Joomla! 4 which relies on it heavily. Locations of class files vary by release, and finding them and reviewing the code within each is made a bit more elusive with Joomla! 4 name space changes. But there is current backwards compatibility and hence, lists of aliases do exist as we shall see next.
Since deprecated classes in Joomla 3.8.x will be removed in Joomla! 5 it is wise to use the new ones, aliased starting with Joomla! 3.8. Be sure you note and observe any changes in the current or future versions of Joomla! as code may break if the Joomla! team removes it. If a class for example or design pattern is obsolete now and deprecated it is indicated very clearly. These and [other changes](https://developer.joomla.org/news/703-joomla-3-8-beta-released-for-testing.html) should be reviewed in preparation for Joomla! 4. For now, class names that eventually will raise exceptions and error messages in your component code are facilitated; backwards compatibility exists until Joomla! 5. Since deprecated classes in Joomla 3.8.x will be removed in Joomla! 5 it is wise to use the new ones, aliased starting with Joomla! 3.8. Be sure you note and observe any changes in the current or future versions of Joomla! as code may break if the Joomla! team removes it. If a class for example or design pattern is deprecated and will be obsolete by the next major release, it is indicated very clearly. These and [other changes](https://developer.joomla.org/news/703-joomla-3-8-beta-released-for-testing.html) should be reviewed in preparation for Joomla! 4. For now, class names that eventually will raise exceptions and error messages in your component code are facilitated; backwards compatibility exists until Joomla! 5.
A class file that is very important to facilitate this and is currently being used is the class map of aliases for classes that do not conform to the namespace naming convention. The file at \libraries\classmap.php should be consulted when writing your own components. The path on the right has the locations and new standard naming for class files. There is a class file that is very important to facilitate this and is currently being used. It is the class map of aliases for classes that do not conform to the namespace naming convention. The file at \libraries\classmap.php should be consulted when writing your own components. The path on the right has the locations and new standard naming for class files. There are a few more areas where this occurs that is included below the list. Be aware that if for eaxmple the path is indicated as JLoader::registerAlias('JControllerLegacy', '\\Joomla\\CMS\\MVC\\Controller\\BaseController', '5.0'); the physical path in Joomal! version 3.8.12 is \libraries\src\Application\BaseController.php and the class is named BaseController which extends JObject. Remember, the old ones will eventually be obsolete starting with Joomla! 5. The general namespace naming convention is Joomla! classes begin with the letter J in the namespace. Those that are not are now deprecated and will log warnings in server log files. These are useful to allow cleaning them up eventually. Each line in the class map file has the path to the left that is aliased to the path on the right which is the deprecated one. Joomla! developers are using the namespace extensively and this map conforms the classes in use with the deprecated naming convention to the new ones. The latter should be used in your components sooner rather than later. There are some other areas where aliases exist that should be adhered to eventually for class names and their locations:
Be aware that if for eaxmple the path is indicated as JLoader::registerAlias('JControllerLegacy', '\\Joomla\\CMS\\MVC\\Controller\\BaseController', '5.0'); the physical path in Joomal! version 3.8.12 is \libraries\src\Application\BaseController.php; its class is BaseController which extends JObject. What one needs to recall is the old ones will eventually be obsolete starting with Joomla! 5. They are currently deprecated and will log warnings in server log files. These are useful to allow cleaning them up eventually. Each line in the file has the path to the left that is aliased to the path on the right which is the deprecated one. Joomla! developers are using the namespace extensively and this conforms the classes to the new ones that should be used in your components sooner rather than later.
There are some other areas where aliases exist that should be adhered to eventually for class names and their locations:
Next, we look at demo.php in the root of the JCB Demo component directory and step through its contents, summarizing the actions that lines of code within each perform including the locations of class files behind each.
- [Add unobtrusive JavaScript support to keep a tab state.](https://api.joomla.org/cms-3/classes/JHtmlBehavior.html#method_tabstate) - [Add unobtrusive JavaScript support to keep a tab state.](https://api.joomla.org/cms-3/classes/JHtmlBehavior.html#method_tabstate)
\libraries\cms\html\behavior.php \libraries\cms\html\behavior.php
- [Get a document object and set the component css/js.](https://api.joomla.org/cms-2.5/classes/JFactory.html#method_getDocument) - [Get a document object and set the component css/js.](https://api.joomla.org/cms-2.5/classes/JFactory.html#method_getDocument)