Updated 073 JCB Fields Type Extended (markdown)

Amigo 2019-10-31 06:31:40 +02:00
parent eefe6d3da2
commit 1e9cf80fc3

@ -1,37 +1,37 @@
# JCB Fields Type Extended # JCB FIELDS TYPE EXTENDED
[00:00:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s) [00:00:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
(Click on these time links to see Youtube video) (Click on these time links to see Youtube video)
I would like to give a demonstration and maybe some explanation about the functionality of a Custom field. Some tutorials about this had been given in the past but JCB has improved and there is a little bit of a different look [00:00:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) to that area. Let me do this again and show in the Compiler what it is actually doing. Here are a few views. [00:00:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m46s) I've imported Sermon Distributor which is the most common demo component that I have used and it has a few Custom Fields so I could actually change this. This one is changed to Custom and we see that we've got a few Custom Fields here. The idea was that you would [00:01:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m15s) use the demo components and then figure out how their Custom Fields work. I would like to give a demonstration and maybe some explanation about the functionality of a Custom field. Some tutorials about this had been given in the past but JCB has improved and there is a little bit of a different look [00:00:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) to that area. Let me do this again and show in the Compiler what it is actually doing. Here are a few views. [00:00:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m46s) I've imported Sermon Distributor which is the most common demo component that I have used and it has a few Custom Fields so I could actually change this. This one is changed to Custom and we see that we've got a few Custom Fields here. The idea was that you would [00:01:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m15s) use the demo components and then figure out how their Custom Fields work.
### Custom Fields Connect a table from one View to another ### Custom Fields Connect A Table From One View To Another
[00:01:31](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m31s) [00:01:31](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m31s)
First of all Custom Fields is a way to connect a table from another view of course into another view. Then you can have more than one Custom Field in a table and you can do that to build relationships. You could even take different tables and create a different combined list of values. You can really do anything with Custom Fields it is maybe one of the most powerful Field types in JCB. First of all Custom Fields is a way to connect a table from another view of course into another view. Then you can have more than one Custom Field in a table and you can do that to build relationships. You could even take different tables and create a different combined list of values. You can really do anything with Custom Fields it is maybe one of the most powerful Field types in JCB.
### Custom Fields a Joomla Concept ### Custom Fields A Joomla Concept
[00:02:24](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m24s) [00:02:24](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m24s)
In the Editor, I would like to show you that Custom Fields are basically a Joomla implementation or concept. So in your Models folder, you have a folder called 'fields'. In Joomla 4 this is changing the folder structure but in for now, you will know it is here and so here is our Custom Fields. It is a field that you create by creating a file in this folder and then [00:03:17](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m17s) using the field name in your XML. In the Editor, I would like to show you that Custom Fields are basically a Joomla implementation or concept. So in your Models folder, you have a folder called 'fields'. In Joomla 4 this is changing the folder structure but in for now, you will know it is here and so here is our Custom Fields. It is a field that you create by creating a file in this folder and then [00:03:17](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m17s) using the field name in your XML.
If you look at the form and let's say we use Sermon, you will see that in the XML at the top we have `addfieldpath` and it can be seen that it ends in the model because of how we do it expects it to be here. [00:03:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m44s) That's why it knows to go look for the field here. Now if you scroll down you will see that we have a 'normal' and wherever it says `Joomla`, it means it's a normal field. At the moment it says `custom`, it means that this is not a 'normal' field this field was custom made for this component. Now this (`<--....-->`) is just a note. [00:04:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m11s) It's like the comment it doesn't do anything. So you can come here in the fields area and there are `preachers`. This is the file that makes this work. That's basically what JCB builds, it puts this in place and then builds this file and that's it. [00:04:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m36s) In these files depending on what type of file we are extending; so now we are extending here the list option(`JFormfieldlist`). If you look at the form and let's say we use Sermon, you will see that in the XML at the top we have `addfieldpath` and it can be seen that it ends in the model because of how we do it expects it to be here. [00:03:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m44s) That's why it knows to go look for the field here. Now if you scroll down you will see that we have a 'normal' and wherever it says `Joomla`, it means it's a normal field. At the moment it says `custom`, it means that this is not a 'normal' field this field was custom made for this component. Now this (`<--....-->`) is just a note. [00:04:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m11s) It's like the comment it doesn't do anything. So you can come here in the fields area and there are `preachers`. This is the file that makes this work. That's basically what JCB builds, it puts this in place and then builds this file and that's it. [00:04:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m36s) In these files depending on what type of file we are extending; so now we are extending here the list option(`JFormfieldlist`).
### Where to find the available extension options ### Where To Find The Available Extension Options
[00:04:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m45s) [00:04:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m45s)
To know what is all the available extending options we go to Joomla Component Builder's file and go to the Compiler and to Joomla 3, then scroll down and there is the 'checkboxes' option and there is the 'Field list', the 'Field radio' [00:05:08](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m08s) and the 'Field user' but the field user we actually made a whole custom field to just target the field user but the 'checkboxes' and the 'radio'. If you go back to JCB and create new and select 'Custom' you would see that it at some point asks; what would you like to extend? [00:05:41](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m41s) And here are these three options you can extend that like a **List**, as a **Radio button** or **Checkboxes**. That is what this **'Extend'** is for. So that is currently the only 3 that is ready to go in JCB. There are of course others but then we will have to expand JCB. It doesn't reach those yet. If you are using a form list which is the most common one because you wanted to have a list of things in another table then you to populate the `getoptions` function. To know what is all the available extending options we go to Joomla Component Builder's file and go to the Compiler and to Joomla 3, then scroll down and there is the 'checkboxes' option and there is the 'Field list', the 'Field radio' [00:05:08](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m08s) and the 'Field user' but the field user we actually made a whole custom field to just target the field user but the 'checkboxes' and the 'radio'. If you go back to JCB and create new and select 'Custom' you would see that it at some point asks; what would you like to extend? [00:05:41](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m41s) And here are these three options you can extend that like a **List**, as a **Radio button** or **Checkboxes**. That is what this **'Extend'** is for. So that is currently the only 3 that is ready to go in JCB. There are of course others but then we will have to expand JCB. It doesn't reach those yet. If you are using a form list which is the most common one because you wanted to have a list of things in another table then you to populate the `getoptions` function.
### Code required for Get Option funtion ### Code Required For Get Option Function
[00:06:27](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s) [00:06:27](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)
The `getoptions` function or method is requiring this chunk of code. Now instead of making it that you need to write out this whole thing. [00:06:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMREs&t=00h06m45s) In JCB you are just adding this part for the 'List'. For the 'radio' it is also just the `getoptions`. For the 'Checkboxes' again also just `getoptions`. So it is basically the only code we need to have it's only with the user one [00:07:08](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m08s) which we have a `getgroups` and `getexclude`. And if you select 'Custom user', that is exactly what you get, you get 'getexclude' area and you get 'getgroup' area and these two chunks of code is what is going to be placed [00:07:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m36s) in this area here. That is what is going to happen. So you could at any time come in here and fiddle around with this, I mean in the PHP when the file is created. Like over here, I've got this 'Preacher' open. You can come in here and fiddle with us and then take your changes just back to the view to JCB and just place it in a Custom. That means that the type is movable because it is new but it must be something that doesn't already exist in Joomla. The `getoptions` function or method is requiring this chunk of code. Now instead of making it that you need to write out this whole thing. [00:06:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMREs&t=00h06m45s) In JCB you are just adding this part for the 'List'. For the 'radio' it is also just the `getoptions`. For the 'Checkboxes' again also just `getoptions`. So it is basically the only code we need to have it's only with the user one [00:07:08](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m08s) which we have a `getgroups` and `getexclude`. And if you select 'Custom user', that is exactly what you get, you get 'getexclude' area and you get 'getgroup' area and these two chunks of code is what is going to be placed [00:07:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m36s) in this area here. That is what is going to happen. So you could at any time come in here and fiddle around with this, I mean in the PHP when the file is created. Like over here, I've got this 'Preacher' open. You can come in here and fiddle with us and then take your changes just back to the view to JCB and just place it in a Custom. That means that the type is movable because it is new but it must be something that doesn't already exist in Joomla.
### Where to find a list of all Joomla's Field Types ### Where To Find A List Of All Joomla's Field Types
[00:08:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m19s) [00:08:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m19s)
@ -39,22 +39,23 @@ The `getoptions` function or method is requiring this chunk of code. Now instead
**Going back to create a Custom Field.** [00:09:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m12s) We could start with Sermon Preacher which is the one we are looking at. So again the name up here is just for the interface for you, it's just that you can see what is the field. You can call this anything. It only falls back to this name if there isn't a label set here, then it will fall back to this name. [00:09:39](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m39s) But the ideal is just set the label. **Going back to create a Custom Field.** [00:09:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m12s) We could start with Sermon Preacher which is the one we are looking at. So again the name up here is just for the interface for you, it's just that you can see what is the field. You can call this anything. It only falls back to this name if there isn't a label set here, then it will fall back to this name. [00:09:39](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m39s) But the ideal is just set the label.
The name here is actually the code(See video) This is the type and this is what is going to be unique. The rest is multiple, the same as everything else. The default value because it is dynamic, it is not really practical but it is really going to be whatever you choose to be the ID of this memory. [00:10:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m11s) 'Required', 'Read Only', etc. In this area choose what kind of field you would like to create.
The name here is actually the code(See video) This is the type and this is what is going to be unique. The rest is multiple, the same as everything else. The default value because it is dynamic, it is not really practical but it is really going to be whatever you choose to be the ID of this memory. [00:10:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m11s) 'Required', 'Read Only', etc. In this area choose what kind of field you would like to create.
### The Button Feature ### The Button Feature
[00:10:20](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s) [00:10:20](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s)
Then the 'button' feature is one of the features that are actually quite exciting. Let me show you some of that. So I was seeing a strange behavior here that the button says 'true' and then when I go to the code I don't see the button code in here. I was wondering what is going on here and then I remembered when JCB detects that [00:10:48](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m48s) there is two Custom Fields with the same type, it only uses one for this area and for the button because one of them is going to be the dominant one. [00:11:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m12s) You can decide which one it is so you want to share the field type among multiple Custom Fields so you want to reuse that field type, you can, but you want to make sure that one of them is the one which you know is going to be dominant, the one who decides how things happen. So that if you change that one the field type updates whereas if you change the wrong one it doesn't do anything. So just one of those will be the [00:11:47](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m47s) the dominant one so you could do that by making it the prime PHP and make that 'one'. Here is a little explanation of that. If you want to be sure this field called 'Preachers' should be the dominant and you want to say; I want the buttons to be 'true' and if you now, save and compile, you will get what you expect. That's **another feature of Custom Fields that people are not aware of** but it makes it very useful. Then the 'button' feature is one of the features that are actually quite exciting. Let me show you some of that. So I was seeing a strange behavior here that the button says 'true' and then when I go to the code I don't see the button code in here. I was wondering what is going on here and then I remembered when JCB detects that [00:10:48](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m48s) there is two Custom Fields with the same type, it only uses one for this area and for the button because one of them is going to be the dominant one. [00:11:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m12s) You can decide which one it is so you want to share the field type among multiple Custom Fields so you want to reuse that field type, you can, but you want to make sure that one of them is the one which you know is going to be dominant, the one who decides how things happen. So that if you change that one the field type updates whereas if you change the wrong one it doesn't do anything. So just one of those will be the [00:11:47](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m47s) the dominant one so you could do that by making it the prime PHP and make that 'one'. Here is a little explanation of that. If you want to be sure this field called 'Preachers' should be the dominant and you want to say; I want the buttons to be 'true' and if you now, save and compile, you will get what you expect. That's **another feature of Custom Fields that people are not aware of** but it makes it very useful.
### Get Input(How Button is added) ### Get Input(How Button is added)
[00:12:29](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m29s) [00:12:29](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m29s)
So if we now go back to the code we see now a new set of a script here called `getinput` And that's really how the button gets added so basically asks `getAttribute('button')` it checks if `button` is `true`. If button is `true` then it already got the parent `HTML` (the whole field is in this HTML). If you have a button and someone clicks on it you might want them to [00:13:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m07s) be redirected back to this page where the field is once they are done on the other page. So this is what it does here it checks if there is a 'Referral'. We are building a return value as well so we come down here and we start to build the button. There is the the button being built(See Video) [00:13:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m44s) That is to create. This is called preachers right and down here we have a view called 'Preacher' and 'Preachers'. So that is the Single View, the Single View name of the place the field is added and this is the 'Listview' . We are grabbing the field data from the Preacher View and it's List name is 'Preachers' so it is the table where the data is being captured from. Not the table where you are going to show the field but the table where you are taking the information from.>>>>>>> So if we now go back to the code we see now a new set of a script here called `getinput` And that's really how the button gets added so basically asks `getAttribute('button')` it checks if `button` is `true`. If button is `true` then it already got the parent `HTML` (the whole field is in this HTML). If you have a button and someone clicks on it you might want them to [00:13:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m07s) be redirected back to this page where the field is once they are done on the other page. So this is what it does here it checks if there is a 'Referral'. We are building a return value as well so we come down here and we start to build the button. There is the the button being built(See Video) [00:13:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m44s) That is to create. This is called preachers right and down here we have a view called 'Preacher' and 'Preachers'. So that is the Single View, the Single View name of the place the field is added and this is the 'Listview' . We are grabbing the field data from the Preacher View and it's List name is 'Preachers' so it is the table where the data is being captured from. Not the table where you are going to show the field but the table where you are taking the information from.>>>>>>>>>>
[00:14:55](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h14m55s) Now you take it from multiple tables then he must choose a dominant table The one that you want to be Always available So that's what this is as well as this as you can see It is obviously usually the case that this and this values the same But I decided to just give us The option to change the table name anyway Ok so we Will get to these again Just wanted you to see you [00:15:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) Sorry show you that if those two Actually line-up The button name lines up with those two Then it checks whether this is current user has authority to actually edit buttons We come down here And we create and edit button So And we also write JavaScript to [00:16:01](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m01s) Give that Button behavior when you click Change the field it checks ok Is that value and then it Updates that you can check out this JavaScript here. This one up here is used to generate the create button and it also validates Whether This user Has create Options [00:16:30](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m30s) And is there is a user in the admin area currently this feature is Is not available to the site area and It's because of many conventions in the site area is so custom it'll probably Break this button so We'll have to work at this but this is where we are at we were able to Target the admin area with this kind of button And then if we have a button We actually add the button declaration To the document And then we add the buttons To the field with this [00:17:10](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m10s) Input append this class here Is a Joomla Class Which means we falling back on their implementation on how to add a little tweak to the button sorry to the field So we just add this and that is how the button gets added and how it works You mean you can come through this I mean this is quite simple It's very easy code here This this implementation here is just to make sure that the button name follows the convention And naming convention And [00:17:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m46s) Yeah so that's that's the HTML and JavaScript that sets up the button and The reason why you would sometimes see the edit button there and sometimes not is about this relationship here The Button name Must match one of these So if it doesn't It won't add it It's sort of It's necessary for that to be like that because of You wanna have a [00:18:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m18s) Button that already knows where we going right And how can I know those values at the moment the only values we have here Are these values it's come up here These values We don't have Other values This is the values we have the view ID So That's what we have to work with and so if there's no relationship Then how can we How can we set the edit button the relationship must be set so this is the way we Set a relationship that's quite simple right you just make sure that the name of the [00:18:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m58s) The button this one won't work So although we said the button here to be true It will check the name and see how this doesn't match and it won't add a button and that's good because we don't want that Actually a button here we want a button to show up in this one And so when it loads this button It will check the name it'll say ah yeah this one matches and it will add a button So That's the right behavior That's what we want so if we compile it now &&&&&&&&&&&@@@ We can just come here [00:19:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m36s) And go to sermons Click here We'll see it now has an edit option If we select none and has a great option Select this it has a edit option That is sort of how that relationship comes together So were are we go back To the field [00:20:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m07s) Ok So Oh this is a wrong one So now we have the buttons set That's really the whole discussion And you could if you don't want the button set But you want the button on the page Set this to false Or just leave it out yeah it will take the button away completely Now this table value is a mandatory value [00:20:40](https://www.youtube.com/watch? [00:14:55](https://www.youtube.com/watchv=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m55s)
Now you take it from multiple tables then he must choose a dominant table The one that you want to be Always available So that's what this is as well as this as you can see It is obviously usually the case that this and this values the same But I decided to just give us The option to change the table name anyway Ok so we Will get to these again Just wanted you to see you [00:15:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) Sorry show you that if those two Actually line-up The button name lines up with those two Then it checks whether this is current user has authority to actually edit buttons We come down here And we create and edit button So And we also write JavaScript to [00:16:01](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m01s) Give that Button behavior when you click Change the field it checks ok Is that value and then it Updates that you can check out this JavaScript here. This one up here is used to generate the create button and it also validates Whether This user Has create Options [00:16:30](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m30s) And is there is a user in the admin area currently this feature is Is not available to the site area and It's because of many conventions in the site area is so custom it'll probably Break this button so We'll have to work at this but this is where we are at we were able to Target the admin area with this kind of button And then if we have a button We actually add the button declaration To the document And then we add the buttons To the field with this [00:17:10](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m10s) Input append this class here Is a Joomla Class Which means we falling back on their implementation on how to add a little tweak to the button sorry to the field So we just add this and that is how the button gets added and how it works You mean you can come through this I mean this is quite simple It's very easy code here This this implementation here is just to make sure that the button name follows the convention And naming convention And [00:17:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m46s) Yeah so that's that's the HTML and JavaScript that sets up the button and The reason why you would sometimes see the edit button there and sometimes not is about this relationship here The Button name Must match one of these So if it doesn't It won't add it It's sort of It's necessary for that to be like that because of You wanna have a [00:18:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m18s) Button that already knows where we going right And how can I know those values at the moment the only values we have here Are these values it's come up here These values We don't have Other values This is the values we have the view ID So That's what we have to work with and so if there's no relationship Then how can we How can we set the edit button the relationship must be set so this is the way we Set a relationship that's quite simple right you just make sure that the name of the [00:18:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m58s) The button this one won't work So although we said the button here to be true It will check the name and see how this doesn't match and it won't add a button and that's good because we don't want that Actually a button here we want a button to show up in this one And so when it loads this button It will check the name it'll say ah yeah this one matches and it will add a button So That's the right behavior That's what we want so if we compile it now &&&&&&&&&&&@@@ We can just come here [00:19:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m36s) And go to sermons Click here We'll see it now has an edit option If we select none and has a great option Select this it has a edit option That is sort of how that relationship comes together So were are we go back To the field [00:20:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m07s) Ok So Oh this is a wrong one So now we have the buttons set That's really the whole discussion And you could if you don't want the button set But you want the button on the page Set this to false Or just leave it out yeah it will take the button away completely Now this table value is a mandatory value [00:20:40](https://www.youtube.com/watch?