Updated 008 Advanced Fields (markdown)

Amigo 2019-06-05 15:57:07 +02:00
parent 77dbce810b
commit e907f7ec75

@ -50,54 +50,56 @@ We are trying to build a component, not as yet to extend component builder itsel
Once you have built a component and know where you have made those changes in component builder you can look at the files if you know how to build a Joomla website. I used the same conventions as decor in regards to implementation of the files. [00:22:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m07s) Once you have built a component and know where you have made those changes in component builder you can look at the files if you know how to build a Joomla website. I used the same conventions as decor in regards to implementation of the files. [00:22:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m07s)
**Dropbox Custom List Example** **Dropbox Custom List Example**
We can quickly look at Dropbox manual file list. [00:22:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m36s) This one is much more advanced. What we are dealing with here is a file that is stored. What I did is I created a function in my component global helper function called 'getDropboxlinks'. It tells you it [00:23:02](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) wants manual links and it passes a specific variable '2'. And it would return a bunch of links and those links, will check if it exists. It will check the array, not only that it is an array but that it has values in it. And if it does, it actually just backs it into the options [00:23:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m24s) And gives it over to the options array, to the list. We will now look at Dropbox manual file list, which is more advanced. [00:22:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m36s) We are dealing here with a file that is stored. I created a function in my component global helper function called 'getDropboxlinks'. It wants manual links and passes a specific variable '2'. [00:23:02](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) It would return some links which it will check to see if it exists. It will check the array and the values in it. If it does, it backs it into the options and gives it over to the options array, to the list. [00:23:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m24s)
**Component Helper Class** **Component Helper Class**
This part here means that you can add a helper static method call in your custom field types, [00:23:44](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s) this two symbols(::) mean that it is a static method being called from a class. Now this class is something that if you know the Joomla API and know how to work with builder component, you will know that you can add to any component what is known as a component helper class. [00:24:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m07s) If I was to go to sermon distributor, the component helper class is always located in the helper folder of the admin as well as the site view. The admin is then in the back end in which is administrative components. [00:24:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m28s) There(See video) is the component and there is its helper folder. In the front end you have the same convention, component, sermon distributer, and there is the helper structure. Here(See video) is some of the [00:24:49](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m49s) script of sermon distributor structures through its helper structure. There(See video) is the helper file for the front. Here(See video) is helper file for the back. This part means that you can add a helper static method call in your custom field types. [00:23:44](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s) These two symbols mean that it is a static method being called from a class. If you know the Joomla API and how to work with builder component, you will know that you can add a component helper class to any component. [00:24:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m07s) If I go to sermon distributor, the component helper class is always located in the helper folder of the admin as well as the site view. The admin is in the back end in which is administrative components. [00:24:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m28s) There you'd see the component and its helper folder. In the front end you have the same convention, component, and sermon distributor. There is the helper structure. Here is some of the script of sermon distributor structures through its helper structure. There is the helper file for the front. Here is helper file for the back. (See video.) [00:24:49](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m49s)
Now to add methods [00:25:09](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m09s) to the helper files. If you want to know what all the custom helpers is that we ship with all components, you can open component builder. You can go to the compiler and to Joomla 3 and then look for the helper file in the site helper file. [00:25:30](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m30s) If you open it you will see a whole lot of helper methods. Obviously with a lot of place holders which we will customized for each component that it targets that component. You would see there is a Json to string method here just to 'getvars'. There's a 'getvar' singular. This is just to get one variable from the database so you don't need to to rewrite [00:25:55](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m55s) this whole string to get just one variable. You can come and look at how this works and use this to get a variable from the database. We also have 'ispublished' to check if a specific object is published. [00:26:14](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m14s) This is way beyond the scope of just looking at custom fields. We will go into great depth into all the features of a helper structures when we deal with advanced concepts. This is just a heads up so that you can start looking at it and possibly get yourself going. I wrote these functions, checkobject, checkarray, checkstring, [00:26:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m40s) checkJson, shorten, mergearrays, savestring, and HTMLescape, replacenumbers, this one I'm using quite often. If you do savestring [00:26:58](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m58s) we change every number in the string immediately to text, so that you can be sure whatever you get back from savestring doesn't have numbers in it. This is quite necessary especially if you don't know if the first character might be a number. [00:27:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m20s) In this way we are insuring that it is always text. **Adding Methods to the Helper Files**
If you want to know what the custom helpers are that we ship with all components, you can open component builder. Go to the compiler and Joomla 3 then look for the helper file in the site helper file. [00:25:30](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m30s) If you open it you'll see many helper methods. With a lot of place holders we customize for each component that targets that component. You'd see a Json to string method here to 'getvars'. (See video.) There's a 'getvar' singular. This is getting one variable from the database so you don't need to rewrite the whole string to get one variable. [00:25:55](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m55s) You can look at how this works and use it to get a variable from the database. We also have 'ispublished' to check if a specific object is published. [00:26:14](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m14s) I wrote these functions. (See video.) [00:26:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m40s) If you do savestring we change every number in the string to text, so that you can be sure that whatever you get back from savestring doesn't have numbers in it. [00:26:58](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m58s) In this way we are insuring that it is always text. It's is quite necessary, especially if you don't know if the first character might be a number. [00:27:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m20s)
**Strings** **Strings**
There is a whole bunch of custom methods that we ship with all components that are developed. So if you were to open like I have said, 'sermon distributors', [00:27:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m40s) 'helper class', you will see that these helper classes are all showing up , getactions, shortenstring, mergearray. [00:28:00](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m00s)If you may have a better way of doing this please go on the forums at Github and bring that to my attention. I know I recently tried to improve on this checkstring by doing that(adding {}). So I could actually dump this part(&& strlen($string)>) and save on [00:28:22](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m22s) the query. But for some strange reason this started causing problems all over and strings that were strings were being returned as not being strings. But what I can tell you is that I [00:28:41](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m41s) went back to the old school way of doing it. Which is this way(taking out the {}). I don't know if there might be an easier way. Obviously we first want to ensure that this value($string) is set. If then it is a string, then it actually has a length. Something can be a string and yet does not have a length. [00:29:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m04s) There are many custom methods that we ship with all components that are developed. [00:27:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m40s) If you were to open 'sermon distributors', 'helper class', you'd see that these helper classes are all showing up. (See video.) [00:28:00](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m00s) If you have a better way of doing this, please go on the forums at Github and bring it to my attention. I recently tried to improve on this checkstring by doing adding {}. The plan was that I could dump this part(&& strlen($string)>) and save on the query. [00:28:22](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m22s) But for some reason it started causing problems and strings were being returned as non-strings. [00:28:41](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m41s) So I went back to the old school way of doing it. We first want to ensure that this value is set. If it is a string, then it has a length. Something can be a string and yet not have a length. [00:29:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m04s)
Back to the UI. That is where I get these values. (See video)[00:29:29](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m29s) where it says 'getDropboxlinks'. We see that it has this thing '$return' which is set to false. That means if I only was to say, that it should return the manual values, then it will only return the value manual links. But since I've set it [00:29:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m52s) to 2, it will return all of those links and not just one of them, because you can target that it should return one specific sermons link. This method is quite dynamic. That is all I am calling in this advanced [00:30:15](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m15s) field type which is called 'custom field' and it gives me an array of all the links which I have just loaded like I have explained. It is quite an advanced implementation of this custom fields. [00:30:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m37s) With that list concept you can almost do anything, you can even grab a bunch of website names from somewhere. You can put any PHP in there and build a list which can be used to save to the database. Back to the UI. That is where I get these values where it says 'getDropboxlinks.' (See video.) [00:29:29](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m29s) We see that it has '$return' set to false. It means that if it should return the manual values, then it will only return the value manual links. Since I've set it to 2, it will return all of those links because you can target that it should return one specific sermons link. [00:29:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m52s) This method is dynamic. That is all I am calling in this advanced field type which is called 'custom field' and it gives me an array of all the links which I have loaded. [00:30:15](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m15s) It is an advanced implementation of these custom fields. [00:30:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m37s) With that list concept you can nearly do anything, even grab a bunch of website names from somewhere. You can put any PHP in there and build a list which can be used to save to the database.
**Custom User** **Custom User**
There's also a function called custom user. [00:31:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m08s) In the custom user, you don't need to set or change anything from [00:31:25](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) here to there(See video). All those should actually just work. The only part that you want to consider removing, would be the PHP, this part here(see video). Basically what this part does, it limits the user list [00:31:47](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m47s) to only a certain group. That means again you need to set up a global value in your component field. In the Global, as mentioned previously, if you click on 'options', [00:32:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m07s) it will opens a place which you need to set 'global'. These are all global values. This is a area for global values. You can get hold of those global values through the component helper 'getparams' with a component name and get (###text###) you would place the field name. [00:32:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m28s) That's how you can get a value from your global settings. And basically I'm getting a specific groups value and placing it in here(groups). And then I am returning that group. That is all this part(see video) is doing. Those two sections are actually independent. So this one is what helps you set [00:32:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m52s) to return a specific group. There's also a function called custom user. [00:31:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m08s) In the custom user, you don't need to set or change anything here. (See video.) [00:31:25](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) All of these should just work. The only part that you want to consider removing would be the PHP here. (See video.) What this does is it limits the user list to only a certain group. [00:31:47](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m47s) It means that you need to set up a global value in your component field. In the Global, as mentioned previously, if you click on 'options', it opens a place where you need to set 'global'. [00:32:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m07s) These are all global values. This is an area for global values. You can get hold of these global values through the component helper 'getparams' with a component name and get. (###text###) You would place the field name. [00:32:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m28s) That's how you can get a value from your global settings. I'm getting a specific groups value and placing it in here. Then I return that group. That is what this is doing. (See video.) Those two sections are independent. This one is the one that helps you set to return a specific group. [00:32:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m52s)
**The Exclude Feature** * **The Exclude Feature**
This part helps you set any users you want to exclude. This specific feature here(See video) ensures that only one record per user is set. Let's say a user has already been added to a previous record, then that user should not show up again. [00:33:18](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m18s) It should be removed from the list. This is what this PHP is doing. It's simply looking to this current view and checking if there is users and getting their ID's and setting them up in their unique manner and then returns them. [00:33:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m36s) If you are building something which are supposed to have student details, for example, you don't want a student to have more than one entry in that table, you want every student to just have one. [00:33:58](https://www.youtube.com/watch?v=VpzYbifHTMLqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m58s) So if a student is already selected, you do not want them to be selected again, that's what this exclude feature does. This part helps you set any users you want to exclude. This specific feature here ensures that only one record per user is set. (See video.) Let's say a user had already been added to a previous record, then that user should not show up again. [00:33:18](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m18s) The user should be removed from the list. This is what this PHP is doing. It looks to the current view and checks if there are users; it gets their ID's and sets them up in their unique manner, then returns them. [00:33:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m36s) If you are building something which are supposed to have student details, for example, you don't want a student to have more than one entry in that table; you want every student to just have one. [00:33:58](https://www.youtube.com/watch?v=VpzYbifHTMLqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m58s)
Now to show that to you in the code. Let's go to another project that I am working on: 'Learning Manager and Models.' There are fields called studentusers and studentuser. [00:34:27](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m27s) There are two ways to do this. One is not allowing more than one user to have an entry; the other is excluding users that have already been used. That means if a user have been selected, the other one returns null. [00:34:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m52s) In other words, it will always show all users. The way to have it set to null would be to remove this part of the code. (See video.) Then Component Builder will automatically set this 'return null' value to null. When it gets to the group part the principle is the same. [00:35:19](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m19s) If you don't want it to show a specific group, you can set it to null. All you need to do is remove that part of the code and it will target a specific group or to remove specific users. [00:35:48](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m48s) For example: If you want to remove users that belongs to another table or structure, all the PHP that you need to write can be placed on the 'type_phpx'. [00:36:11](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m11s) So all your PHP can be placed in here for excluding. (See video.) [00:36:33](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m33s) This 'type_php_1' will be used for the groups. It says Getexcluded method and PHP for the getgroup method and in the code which is stored under 'fields'and 'models' where can be seen what it does. You can do things and then look what Component Builder build. [00:36:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m59s) You can go to any view and see how it works.[00:37:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m24s) You will use that(preacher).
Here is a select list; here you have the values. That's the IDs and the actual name of the speaker. This is how it should display the data. Component Builder sets up the XML structure that Joomla uses to build this. [00:37:53](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m53s) Joomla is building this whole structure for you. It is done through these XML input values that you are adding here. [00:38:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m08s)
* **No Underscores or Spaces**
Something to remember here: the type names may not have underscores or any spaces in them. Anything that isn't translatable usually needs to be without spaces. [00:38:35](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m35s) You must also remove the underscore. You can use uppercase but it will be become lowercase anyway. [00:38:57](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m57s) This works because it isn't only used in the file database but also in the name convention and everywhere this file type is. You can see in here that the file type is called studentusers and even the file is called studentusers. [00:39:21](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m21s) Specific type name is used everywhere.
Now to show that to you in the code. Let's go to another project that I am working on called learning manager and models. And they have a field called studentusers and studentuser. [00:34:27](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m27s) There are two kinds of ways to do this. One is to not allow more than one user to have an entry and the other is saying exclude users that already have been used. So that means if a user have been selected, [00:34:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m52s) the other one returns null, which means it will always show all users. The way to have it set to null would be simply to remove that part(selected on video) of the code. Then Component Builder will automatically set this 'return null' value to null. When it get to the group part the principle is the same. [00:35:19](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m19s) If you don't want it to just show a specific group, you can actually set it to null. Like that(return null) and Component Builder will do that. All you need to do is simply remove that part of the code and it will target a specific group [00:35:48](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m48s) or to remove specific users. For example: If you want to remove users that belongs to other table or other structure, then all the PHP that you need to write, you can place it on the 'type_phpx'. [00:36:11](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m11s) So you could do that 'type_phpx_1='. and all your PHP can be placed in here for excluding. [00:36:33](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m33s) This 'type_php_1' will be used for the groups. It actually says Getexcluded method and PHP for the getgroup method and in the code which is stored under 'fields'and 'models' can be seen what it does. You can do things and then come and look [00:36:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m59s) what Component Builder build. You can go to the view like we have here(See video) and see how it actually work. Is the preachers showing up? You can use firebug and you can look,<< You can update these fields. Mostly they are fields that are related to all the other fields. [00:40:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m07s) This one specifically says extends user. It shows you how it's going to extend it. If you removed all the PHP, the field like this will show all users every time. [00:40:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m28s)
that one is [00:37:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m24s) of the index. You will use that(preacher). Here is a select list. And here you have the values. So that's the IDs and that is the actual name of the speaker. The ID and the name. That is how it should display the data. Component Builder sets up the XML structure that Joomla uses [00:37:53](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m53s) to build this. Joomla is building this whole structure for you. So even this nice button and everything is Joomla's handiwork. It is doing that for you and this is all done through these XML [00:38:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m08s) input values that you are adding here. So you would change the type to, you might say, staff members.
There is something to remember here. The type names may not have underscores or any spaces in them. Anything that is not translatable usually needs to be [00:38:35](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m35s) not have any spaces. So you can't do this(add spaces). It will not work. So you must remove the underscore. You can do that(Uppercase M) but that will be made lowercase anyway. [00:38:57](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m57s) So you could just do that(lowercase m) instead. It will work because that is used not only in the file database but it's also used in the name convention and everywhere this file type is. So as you can see in here(code) that file type is called studentusers. And even the file is called that(studentusers). [00:39:21](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m21s) And here it is called studentuser, and here it is called studentuser. And this one(jformfieldstudentusers) is with the s. That one(studentusers) with a s. In the file is also with a s. So you can see that specific type name is used everywhere. And you cannot have underscores in this class name. Neither in this type name. [00:39:46](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m46s) Maybe you can but so far my experience is that it doesn't work if you do have it. For some reason it doesn't work. That's just a heads up on naming of this type. So you can update these fields. They are mostly fields that are [00:40:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m07s) related to all the other fields. But this one specifically says extends user. It shows you how it's going to extend it. So if you removed all the PHP then this field as it is now, will show all users everytime. Let me just [00:40:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m28s) close out here. That is looking at the advanced field type called custom user.
**Repeatable Custom Fields** **Repeatable Custom Fields**
Another one we need to look at is the repeatable fields. Repeatable fields is actually not that difficult but you need to understand how it's structured. You need to first create the fields that you want to repeat inside of repeatable fields. The way repeatable field structure looks [00:40:55](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m55s) in Joomla, I mean when we look at it in the actual application. Let me see where did I used a repeatable field. OK here we have one. So this from there all the way to there(see video) is one repeatable field. And if you know a little XML and you worked with repeatable fields, you'll see that [00:41:23](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m23s) here is the the fields that are being repeated inside of the repeatable field. Repeatable field is a field type that has other fields inside of it. Now you don't need to write any of this. The way you would structure a repeatable field is very simple. [00:41:47](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m47s) You first create the fields that you want to repeat. And do realize you can't use repeatable fields in repeatable fields. But you can use custom advanced fields in repeatable fields. Repeatable fields aren't that difficult but you need to understand how it's structured. First you need to create the fields that you want to repeat inside repeatable fields. [00:40:55](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m55s) This is a repeatable field. (See video.) If you know a little XML and worked with repeatable fields, you'd see that the fields are being repeated inside of the repeatable field. [00:41:23](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m23s) Repeatable field is a field type that has other fields inside of it.
So if you look at that we have here again you see there is a field type called: 'cause and risks'. If you know Joomla you would know there is no such field type 'cause and risks'. So that means this is a custom field. If I were to go to fields, [00:42:16](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m16s) you will see there is a field called 'cause and risks'. And it gets it information from this database table. This is another component that I've done with component builder. And it is [00:42:35](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m35s) displaying those data. Also making some model changes to the data. And adding some style to it. Nonbreaking space and stuff like that. That is just dealing with the cause and risks. You don't need to write any of this. It's very simple to structure a repeatable field. [00:41:47](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m47s) First you create the fields that you want to repeat. You can't use repeatable fields in repeatable fields, but you can use custom advanced fields in repeatable fields.
So looking again at our repeatable field you're able to add an advance custom field inside of it. [00:43:00](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m00s) But what you need to add it, is let's open females for our example as you need to have the field ID and you need to order it according to the order you want to displayed in the line [00:43:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m17s) where you do repeatable fields. If we close here and then we go back to creating a new admin view and I click on fields, you will see that there is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, fields in one row. If I click next they all appear again, [00:43:43](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m43s) and if I click next they all appear again. And that's what repeatable fields is about. Now this structure, these fields if we would look at it how did I develop this specific pop-up repeatable structure. I can show that to you. Here is a list of all the repeatable fields that I've already built. This three pages of 20. [00:44:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m08s) If we were to click on add fields for views, open that, this is the repeatable field for adding fields for views. All you see here as I'm saying you could add 800 fields it way over kill. But ok. [00:44:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m37s) And we call him the button add. * **Cause and Risks**
Here is a field type called 'cause and risks'. (See video.) If you know Joomla you'd know there is no such field type. That means that this is a custom field. If you were to go to fields, you'd see a field called 'cause and risks'. [00:42:16](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m16s) It gets its information from this database table. This is another component that I've done with component builder. [00:42:35](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m35s) It is displaying that data, making some model changes and adding some style to the data.
You're able to add an advance custom field inside of a repeatable field. However, for example, you need to have the field ID and you have to order it according to the order you want it displayed in the line where you do repeatable fields. [00:43:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m17s) Here you will see that there a number of fields in one row. (See video.) If I click next they all appear again etc. [00:43:43](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m43s) That's what repeatable fields is about.
Here I developed this specific pop-up repeatable structure. (See video.) Here is a list of all the repeatable fields that I've already built. There are three pages of 20. [00:44:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m08s) If we were to click on add fields for views, this is the repeatable field for adding fields for views. [00:44:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m37s)
**Joomla Icons Info & link** **Joomla Icons Info & link**
So if we go back to the view, see it says add. Then I'm adding an ID in a class to it. A description which if we were to hover over it here(fields) it has a little setup fields for this view which is the description. [00:44:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m59s) Same there(discription) see and the label is fields. So it says there fields. Then the icon is list. Now the icon is what is shown in the button. That is a list. All that custom Joomla icons [00:45:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m17s) can can be used. And to know these icons you should go to a URL Docs.joomla.org/J3.x:Joomla_Standard_Icomoon_ fonts. That is the URL and you'll get to this(Available Icomoon Icons) page. [00:45:41](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m41s) These are all the available icons and you basically use that(contract-2 and checkmark-circle) parts. If I wanted to checkmark-circle, copy checkmark-circle and I would [00:46:02](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m02s) change the icon to checkmark-circle. So that's how you change the icon and then these are simply the ID's of the fields I want inside of the repeatable field. If I was to [00:46:22](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m22s) show you where to get the ID, it simply would be close your repeatable field. And you'd see the ID is next to the fields there on the right. So you would create the fields that you want to use in the repeatable field. And you would get a list of those ID's jotted down somewhere in a notepad or something. Just add them in the [00:46:51](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m51s) order that you want them to be added. Then inside of your repeatable field you would simply paste it in the fields area with a comma separating them. And then component builder will dynamically construct this whole structure for you [00:47:11](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m11s) and add it to your component. I think it's really stunning and I hope you enjoy using the repeatable fields structure. I know it's little buggy still and there's a lot of talk about it not being as stable. But your normal basic fields like text fields and radio buttons and so forth they all work well. The only thing about the radio buttons that you use in [00:47:39](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m39s) the repeatable fields you need to remove the class ff your radio button. It cannot be a button. It must be a dot unfortunately they don't yet make it possible to actually load the button. Now what's the difference? [00:47:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m59s) The difference is, let me see if I can quickly show you. That(Add CSS YES/NO) is the button version of a radio button. That(searcable Yes/No) is the dot version of the radio button. And it doesn't look like a button. [00:48:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m20s) In your repeatable fields you cannot use the button version. It needs to be this one(searcable Yes/No). What makes it a button? It is the class that is being added to the field. So you need to remove the class values from your radio button if it's going to be used in the [00:48:38](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m38s) repeatable field. If you forgot to do that and you compile your component and now you are looking at the repeatable field you'll see that the radio button is not working, but that it messed up until they possibly fix it. This is unfortunately the case. That is looking at advanced fields [00:49:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h49m04s) called custom fields, custom user fields, as well as repeatable fields. These are really the advanced field types that there are. If we go back to the view, you'd see that it says add. I'm adding an ID in a class to it. A description would appear if we were to hover over it. It has a little setup field for this view which is the description. [00:44:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m59s) Same there(discription) see and the label is fields. So it says there fields. Then the icon is list. Now the icon is what is shown in the button. That is a list. All that custom Joomla icons [00:45:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m17s) can can be used. And to know these icons you should go to a URL Docs.joomla.org/J3.x:Joomla_Standard_Icomoon_ fonts. That is the URL and you'll get to this(Available Icomoon Icons) page. [00:45:41](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlER close out here. That is looking at the advanced field type called custom user.LQgpMRE&t=00h45m41s) These are all the available icons and you basically use that(contract-2 and checkmark-circle) parts. If I wanted to checkmark-circle, copy checkmark-circle and I would [00:46:02](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m02s) change the icon to checkmark-circle. So that's how you change the icon and then these are simply the ID's of the fields I want inside of the repeatable field. If I was to [00:46:22](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m22s) show you where to get the ID, it simply would be close your repeatable field. And you'd see the ID is next to the fields there on the right. So you would create the fields that you want to use in the repeatable field. And you would get a list of those ID's jotted down somewhere in a notepad or something. Just add them in the [00:46:51](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m51s) order that you want them to be added. Then inside of your repeatable field you would simply paste it in the fields area with a comma separating them. And then component builder will dynamically construct this whole structure for you [00:47:11](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m11s) and add it to your component. I think it's really stunning and I hope you enjoy using the repeatable fields structure. I know it's little buggy still and there's a lot of talk about it not being as stable. But your normal basic fields like text fields and radio buttons and so forth they all work well. The only thing about the radio buttons that you use in [00:47:39](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m39s) the repeatable fields you need to remove the class ff your radio button. It cannot be a button. It must be a dot unfortunately they don't yet make it possible to actually load the button. Now what's the difference? [00:47:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m59s) The difference is, let me see if I can quickly show you. That(Add CSS YES/NO) is the button version of a radio button. That(searcable Yes/No) is the dot version of the radio button. And it doesn't look like a button. [00:48:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m20s) In your repeatable fields you cannot use the button version. It needs to be this one(searcable Yes/No). What makes it a button? It is the class that is being added to the field. So you need to remove the class values from your radio button if it's going to be used in the [00:48:38](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m38s) repeatable field. If you forgot to do that and you compile your component and now you are looking at the repeatable field you'll see that the radio button is not working, but that it messed up until they possibly fix it. This is unfortunately the case. That is looking at advanced fields [00:49:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h49m04s) called custom fields, custom user fields, as well as repeatable fields. These are really the advanced field types that there are.