From c8eaedf460734189805290168993b60617a1d0df Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Mon, 28 Oct 2019 15:27:28 +0200 Subject: [PATCH] Updated 073 JCB Fields Type Extended (markdown) --- 073-JCB-Fields-Type-Extended.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/073-JCB-Fields-Type-Extended.md b/073-JCB-Fields-Type-Extended.md index 0df1096..09dc01b 100644 --- a/073-JCB-Fields-Type-Extended.md +++ b/073-JCB-Fields-Type-Extended.md @@ -12,6 +12,17 @@ [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 your form And let's say we use Sermon You will see that in the XML At the top we have add file a field path And you see that it edits in the model So Because of how we do it it Expects it to be here [00:03:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m44s) So even yeah anyway So That's why it knows to go look for the field here Now if you scroll down You'll 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 made custom for this component Now this is just a [00:04:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m11s) Note it's like the comment doesn't do anything It's just is for you So this so you can come here In the fields area And there's preachers this is the File that makes this work So That's basically what JCB builds He puts this in place and then builds this file and that's it And so [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 now to know what is all the available extending options we go to Joomla component builders File We go to the compiler We go to Joomla 3 we scroll down we'll see there is the checkboxes Option 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 if you go back to JCB And create new And you select Custom you'd see That it At some point where is it Let's see It asked here what do you extend [00:05:41](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m41s) And you have these three options you can extend that a list as a radio button or a check Checkboxes That is what this Extend is for So That's currently the only 3 that is Ready to go in JCB there there are of course others But then we'll have to expand JCB it doesn't reach those yet Ok so getting back to this If you are using a form list which is the most common one because you wanted have a list of things in [00:06:20](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m20s) Another table Then You're gonna have to populate The get options function Now the get options 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's also just The Get options For the checkboxes again also just get options 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 get groups And exclude And If you create in JCB Excuse me if you Here select custom user You'd see that that is exactly what you get you get exclude area and you get get group 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 in this area here That's basically what is gonna happen So you could at any time Coming here fiddle around with this I mean it in the PHP in when the file is created Like like over over here I've got this preacher open right You can come in here and fill with us and then take your changes just back to the view to JCB And just place it in here not well not in this one this is the user [00:08:05](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m05s) But in a custom Ok so Basically that means that this did the type is movable Because it's new but it must be something that doesn't already exist in Joomla And if you don't know what all the field types are that exist in Joomla then A good place to start is to go to field types And check out all these And if that still isn't clear you can go to this place This URL here This has a list of all Joomlas field types so you could [00:08:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m43s) You could open that Scroll down And here is a list of all the field type names that you can't use again You can't Well it will be conflicting Because it will break that name in that form So Best use names that are not used by Joomla Ok so that is that Going back to creating 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 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 fall back onto this name If If there isn't a A label Set here Then it will fall back onto 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 you know Then the name here This name again is actually the code right That we know this is the type this is what is going to be To be new unique the rest is sort of the same as everything else multiple the default value because it's dynamic It's not really practical But it's really gonna be whatever you choose to be the ID of this Memory right [00:10:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m11s) Required read only this is all &&&&&ok extend here you make your choice what kind of Field do you want to create Then button 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 I was seeing that the button says true And then when I go to the code I don't see the button code in here And I was wondering ok what's 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 there 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 the leader if you will The one who decides how things happen So that if you change that one the field type updates where is 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 prime PHP and make that one so here is a little explanation of that So you wanna be sure this field Called preachers Should be the dominant and you wanna say I want the buttons to be true And now you save and compile You you will get what you expect And so that's another feature of custom fields that people are not aware of this feature but it's it makes it very useful [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 get input And that's really how the button gets added so basically asks Get the attribute button it checks if button is true If button is true Then it already got the parent HTML which is what The button the whole field is in this HTML Then we do some Because 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 done on the other page So this is what it does here it checks if there is a Referral And also we've added the return value As well so if there is a return value We are going to detect it oh no, wait, sorry We are building a return value as well that's right Ok so we come down here And we're starting to build the button so there is the the button being built [00:13:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m44s) And that is to create And then there's also one now You see that if the button name Preacher Or preachers Is Is the same as the area to which you are The preacher..... OK because this this inputs name is preacher right If we go back here [00:14:17](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m17s) This is called preachers right and down here We have a view called preacher and preachers So that is the Single View Right Single View name of the place the field is added And this is the listview so we are grabbing the field data from the preacher View and it's list name is preachers so It's the table where the data is being captured from Not the table where you gonna 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 taking 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?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m40s) Because it gives us a dynamic value which we can use in In many places including here You see a list button gets added to a page as well if we If we look back here at this implementation we see that here is a list Again But this isn't even in the view This is in the list View So you can Have a filter Dynamically in place for this again in the batch as well if you if you select batch [00:21:16](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m16s) There is also one available to select so all of these fields Are still using the information that we give here So if you don't have this information then some of these Fields functions will just Disappear It will Most probably not break But it will not be there so if you to see the fields filtering option is not working then it's because of these settings that are not right Now to give you a perspective on how it adds that This little [00:21:53](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m53s) Drop down here how does it do that Well in the code again if we go to that View Which is the plural preachers And we scroll down We have a Function Called here it is Filter [00:22:20](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m20s) Ok so we go up And we see There's a preachers one Import data What is the buttons filters Looking at the wrong one I should be looking at Sermons So here we have a load field type [00:23:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h23m43s) Preachers And it basically gets options see So this is really targeting This Options area this get options it's calling that function And Then if we have values it actually adds them into the filter And it checks are we doing badge and if this can create can edit validates Yes then it adds it to the batch as well [00:24:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m15s) So We are falling back onto the field type get options even in your filter And so That's why we have the filters easily integrated and it's the value is still use Using The Values that you placed in the field So That's how we get this value that's how we get that value Yeah that's basically it [00:24:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m46s) Ok next We have the components name now the reason why these can be dynamic Is because The table as well as the component name It is possible for you to reuse fields in different admin views and different components and then that can be dynamically update it And it should just work when you want to have a relationship from one Table into another component altogether Then you have to hard code [00:25:21](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m21s) Component a So let's say you have component a where you have a view adminView where this field is used And you want to take the data From That View Into another Component altogether Then you have to add component a's Static name in here and not the placeholder ok that's enough of that there has been discussions on [00:25:51](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m51s) forums about this so you could search up and find answers I suppose Then we have a field value and a key field Value field and key field I should have maybe given this different names I suppose because Basically the key field is the ID field Down here that place holder is the same as here and I'm actually saying it over there The field value Is the text value Over there Now [00:26:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m25s) The code text Is basically This text value again But it didn't gets placed over here so this and that value is basically the same value this is just the one that gets taken to the code Well it's what becomes available in the item So You could Change this to whatever you like this place holders are there only to make your life easier If it doesn't help then just replace them with static values [00:27:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m00s) But the advantage of them being like this is you can come up here and decide I no longer want to store the ID Because this is the value that get stored right it is the value that is over on this side J HTML method setting up an option Takes the second value which is this one has the value that get stored in the database and the third the Value as the value that gets shown in the drop down list So these are the two values that you're working with Now you can add here any PHP you like I mean you could you could grab from any other table you could do a very complicated query here and Generate a whole different list [00:27:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m44s) And just make sure that the ideas are not going to Clash And if you expect ID clashing then if you need to add Maybe ID underscore something for one Place's information ID underscore something else for another place's information you could do that because Because this this selection concept We'll keep on using this pattern all across JCB This is where you set The Relationship [00:28:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m15s) Inheritance structure everything this is just this area and it affects everything across JCB Wherever this field is going to be used This is going to be available So it always It means that you have a lot of Freedom in this little Block because that's what's gonna be at the end of day end up being placed here And You can Get from other tables you can do other and you know interesting relationships here But [00:28:49](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m49s) That is Important that at least the main table Is the one that you mentioned here And the main component is the one you mentioned here And it That Tables View and list views names are used here and then the value I mean in this table this one here You are grabbing two values you're grabbing a value to show to the user [00:29:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m19s) And value to save in the database that's the key value the key field that is the value Get stored in the database if you're using This implementation If you're not then this doesn't really Yeah you can just leave it out if you if you're not gonna use this You can hardcode whatever values you want down here it'll still work infact I would Encourage you to test it You know I have built Fields custom Fields which I left out All of this information [00:29:59](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m59s) And only did everything in here And It still worked Because I was actually having such Dynamic value retrieval based on so many other concepts Of the current view I even grab the ID from the from the input to determine the Get relationship so They are very nice Options let me show you one of those fields Here is the field it's called member it's an external I'm using it in a external component [00:30:34](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m34s) The field type is member Ok so I hard coded the table and the component names But down here in the option the get option You see I have a whole different set of PHP script Which Is using Custom help methods to check access It's also up here We were basically where is it Yeah I'm getting the input and I'm checking is there referral values to a field ID value and if [00:31:09](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m09s) there is it I'm using this This values Down into the searching and getting here it says Load the main member only You know there's all kinds of Tricks I'm doing and it's all happening in the PHP and I know That this PHP Is getting dumped Into this area here So the get options is what is being used across JCB for the field [00:31:39](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m39s) And so I'm able to do anything that you can with PHP in here To determine what the options must be for the custom field Always remembering that there needs to be in This area here the needs to be a value which I want to be placed in the database and a Value I want my user to see these values can Theoretically be exactly the same Like that I didn't have to be really doesn't matter [00:32:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m15s) You decide the only reality is if that's the value you place in the database that's the type of value You need to set up So if this is going to be a string This value here Then you need to come back And you need to Check That your database is not an integer Because if you saving a string you want at least have a Varchar about 250 [00:32:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h32m44s) Now that'll work But if you change the Multiple That means Can a user a select more than one value if you change that true Again you need to change your database to at least text to Be able to store or a very big Varchar which is also possible To store these values if they are gonna be strings then I usually just use text I just like it [00:33:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m18s) Easy enough And if it's going to be lots of options you can go bulk ,there is even way more than I think you would ever need but ok so The reality is we can determine what these values are so here I'm making sure that the member value is an ID But I'm using a helper method To take this ID And get the members name Why because the member's name is difficult to know because it could be different values based on the [00:33:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m58s) Different member types some members there having their name in the user table some members they have in there names in the members table So that's different places the members name can actually live So with this little function I wrote in the helper class I can determine the members name by simply the ID Or I could add the user and the name and it makes it quicker to for the function so this function has Little bit of a speed up if I have these values available but like over here I don't so I only pass the ID and It still works And so This is the maneuverability of a selection [00:34:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m44s) You can adapt this to whatever you want the only reality is that the moment you set Your I would call it convention Of this field type Then you need to honor that Convention across your component If you decide that you're saving a string in that field Then you need to everywhere now you dealing with the string If you're saying you're saving a multiple select then you might wanna Do You know the default storing method usually works Out of the box [00:35:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m19s) If it doesn't you can come and try Json Especially when you have multiple values but usually it does it out of the box and I can show you why If we go to the compiler We go to the fields Class in the compiler it has a function called set Builder Now the set builder function is really a little oversized at the moment it started out Small believe me And I could See the option of decoupling some of this out into its own separate methods but It works very well and it's easy to understand so [00:36:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m00s) If I just collapse this here we can see more So now we come down here we ask what is the data type Is it set And if it's set we determine Through various methods ok This is what we have and we go ahead and we set database keys and all kinds of database relationship information query builder gets updated with a lot of information and stuff So the database information gets used up here If we have ....... it is a different concept [00:36:39](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m39s) if we scroll down We wanna look at the storage switches So coming down here Where we get to setup checkbox and other joint items for this view We are basically Going to check What type of field is this If it's a subform if it's check boxes Or if the store method is not zero which is default If we have a database switch [00:37:17](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m17s) And That it's not a tag the type name Ok now we coming here if it's any of these fields It will check if you set your own storage Switch Obviously if none is set it will fall back onto the Json It needs to be Json If it one of those fields So it automatically builds it so that means the default will be Json then if you select Json it It will still be Json [00:37:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m45s) So that's just how this catch works if you don't know it should be we will In the compiler sort of help you Get to the same place Now That also means that sometimes You might have a multiple select option in a list field which is not a subform not check Boxes But it's multiple The multiple gets triggered the multiple switch so it will still come in here So what even if you set [00:38:22](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m22s) it to be Json Where in the compiler have the multiple Switch to check is this field having multiple selection Yes well then we need to save save it as a Json That is what this does so takes care of the fact that it's Json but It mustn't be a tag and it must have a database switch and database which just means the data Must be going to be stored into the database if there's no storing of the data in the Database we obviously don't need any of this. So the multiple switch If we search it up We'll see that it actually gets passed [00:39:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m07s) To the builder right there one of the it's parameters We go and search Where the Builder all is used will see that the multiple switch is also in a variable So we can go up and you can search You can search for this where does multiple get set Ok so we started of This this method Didn't start with multiple so that scroll down let's see Where is multiple come from [00:39:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m43s) There's multiple And it's set to False to start with Ok So we're in the beginning of set the dynamic field We check multiple is false then we get set field attributes and multiple gets passed to it Let's check field attributes we go let's go to the actual function We see here comes multiple but it's passed with a reference that means he whatever we do to this value In this method We'll go back to where it started So over here [00:40:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m15s) We doing a check At some point Let's see we got Properties Validate Let's search that the variable multiple That's go ha Here we found the property name which is multiple We retrieve the value From the XML Check that the value gets added here and we check is that value true and if it's true we trip the switch [00:40:50](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m50s) To multiple so that literally gets down the through what you put into the JCB Interface This little Field Where is it If you Set this to True it will trip that behavior So that's how that works So the multiple switch is a powerful switch and it Really helps you even if you miss [00:41:21](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m21s) The the storage Obviously it doesn't update the database Selection but if you miss the storage thing The default will work Ok But if you did that it will still work even if you select one of the encryption options it will Still work Because it actually is a little bit intelligent Ok so if we go back here And we go back to the [00:41:52](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m52s) Set Builder The set builder function is one of those places where you could figure out a whole lot of things About how they JCB compiles Custom fields So this is a good place to start you know your search The other one that we already looked at is the set attribute This one here The set attributes is where we actually work with the original values that we get from the database the properties As well as the actual field So [00:42:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m28s) We use the field value to determine many things And we parse every value, the reason why we remapped this is to make sure we can Sort of fix things if you made a mistake So there is some some things here to try and catch Any Human error on the side of JCB that also means you could be doing something wrong and things still work That happens And then someday maybe someone decides no they don't want to catch that fix anymore You know which I'm trying to [00:43:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m07s) You know prevent I wanna keep the The fixing place And then suddenly your Project Doesn't work I'm trying to avoid that But it's good to know how it must be done Right So you just do it that way To start with [00:43:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m25s) Ok So That is Basically a little bit of that, let's go back to the field Suggest in conclusion You could add any kind of code here Basically it is what gets The list and it's with this string here That you are adding options to the list so basically in this little chunk here Basically you check do I have the items if yes you can decide if you want to put a placeholder you [00:43:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m58s) See there select a Preacher if we go to sermon And We We see that it's first option is select a Preacher And it is basically this little snippet here that does that So you could You could do that now The When you do multiple select Then this [00:44:23](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m23s) Doesn't work well just take it from me If you up here Chose To allow multiple Where is it here True Then I would suggest you take this option now [00:44:37](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m37s) Because it will be look like an option to select it won't Behave the same as now Where you actually click away and it's gone it will be an option and The option is a blank there's like a no string That is how We detect That it's empty It's this no string value here Ok so That is what that is up there and then you start looping this t forward slash is basically [00:45:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m07s) A tab so you could put an actual tab in there The way I do that is I would go to you copy a tag from here copy go back And paste it in And You could do this In fact Most of the time this is the better way to To make the code look [00:45:32](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m32s) Beautiful And Correctly spaced This is This is often what I do Is I move all the code Just one little knots In fact I think I needs to be two So I move it all Like this and I know it sounds Crazy But that is what I do [00:45:56](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m56s) So now the code will look very nice and good in the display If I save it Let's Let's make a little comment here Hi there and then This is set to be the prime so save and close And now we can Go and compile this Install [00:46:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m28s) And in our preacher table we have that little hi there And unfortunately the first value should not have a space Yeah the spacing of Of field types is still well many areas actually in JCB It's like where we're at a place where I don't know how we will be able to fix this So that it always behaves sort of better like that is now with you I need to do to get that space in just right And I I know that feels a little Wrong place That feels a little Uncomfortable [00:47:10](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m10s) But it's really It's difficult to catch it correctly for every Implementation So Currently That's the work around so if we compile it and we go back We check it's Now it's correct And there's our little note [00:47:34](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m34s) So our spacing is working out If you didn't add the space it will Sometimes work out something like that That's how it look Ok Which still will work it just doesn't look nice So on this view we have this as a custom field this is a custom field This is category field the tag field And this is a custom field [00:48:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m07s) So we have Many different Custom fields Which is quite nice List folder this is a custom field a multiple select Custom field External This is a custom field This is a custom field So [00:48:29](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m29s) There are many custom fields on this page And you can actually In JCB when you've imported sermon distributor If you don't know how to do that There are tutorials Maybe the best quickest path to showing you that it's just JCB import Then VDM packages How to get Free keys from VBM [00:48:56](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m56s) Because sermon distributor Is one of the three packages There are many free packages not all of them are Free like these are not free But They are even component builder is one of the free packages that you can get a key for So you could click here go get a key I tell you the the The way that we have Build components [00:49:23](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h49m23s) In JCB And all the fields that we've used I mean you can come here you can go to Preacher And all those custom Fields that I just clicked They are here Wait this is not the right one sermon This the one had so many So it's this one To come to Fields and here they are that's custom [00:49:50](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h49m50s) That one is custom This one This one You could click this local file list Wanna see how to list and local file list With a custom field Well this is how I did it I don't even have look here There isn't even Any Table here [00:50:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h50m12s) There's even the button is false Extend list yes I doesn't have a table doesn't have a component none of that I just dumped it And I you see the first one is Back there Now I get parameters I first get the folder path from the global so if you want to see for Example oh how did he set this how to get this setting while let's go out of this would come back here again And out of this Then let's go to the component [00:50:47](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h50m47s) And you'll see that there is a component config area we open that Going of the path a bit but just bear with me And one of those Fields Let's see set up here no it's sermon s there's obviously many in this one Sermon Let's see Sermon menu sermon panel box Sermon media [00:51:27](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h51m27s) Sermon Ok it's not down here execution time Download So It was up here all along Local folder path So it's a It's a text area Which is in sermon tab so if we go here and we click options There is a sermon tab and there it is local folder path so you can set the local folder path for this [00:52:01](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h52m01s) Where the local files are going to be placed And It is because of this file here This field Now if you wanna check the fields check the spelling local folder path close it out And go to fields And type in Local Local ok [00:52:35](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h52m35s) Oops So there it is this a text one we select that Are you can see how I built that Simple field type For the hint Nothing fancy Now I'm going back to our field If we Go back to the field we were looking at We go back to admin View [00:53:02](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m02s) We don't need to go into the sermons But ok that that is a easier way right so we go in here Now we go get into local file Open that So basically in our component We checking this components value for local folder and if it hasn't got one we fall back unto images The image path And that's where we start Now We do a first option [00:53:33](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m33s) Which is please add files and we take the local folder path result And we pass it into here into options Now Then we load the file import Ops classes And we check does the folder exist If it doesn't we create the folder Now check if there is files in the folder So we do get files This is the Function in Jfolder [00:54:04](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h54m04s) And If it's true We actually take the files and we Reset the get options because remember up here we told it to add files but now here with this we reset basically the Options variable And now we start loading the files and then we give it back And so we used both value here see file and file Which is actually very easy way to To do a local folder setup [00:54:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h54m36s) And make people select now again we just looking at demo Component we just looking at it external source manual file is also custom how am I doing this Well it's quite complicated thing so it is a Basically I'm using a helper class get external source link And I don't again look at that there is no table There's no no external component There's nothing Just [00:55:10](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m10s) Just these values go look at it if that's all it is there and it's working that should tell you that you could do the same And get it to go because this is the actual issue this result That's what we need to have correct So having looked at this or get external links source while that's an helper Class how is that close that out Helper classes are stored in the component area So you go to Joomla components Go into the component And you go to libs helpers And here you can scroll down [00:55:49](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m49s) And get download links is a big method get We should have Copy that So here is a function get external source length and has a few arguments And it does a few other get externals listing And does a few trip switches here And That's how I eventually return [00:56:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m18s) Something to that function And We get that list Ok so That's how you should take demo components and Sort of decipher it's implementation structures and don't think it's more complicated than That it isn't it's really simple JCB is very Resilient It can [00:56:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m43s) Adapt itself to Specific implementations So the custom field Is my opinion one of the fields I Have enjoyed Extremely very much And I'm using it all the time everywhere And I am constantly making sure trying to ensure that it's behavior Remains [00:57:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m07s) Yeah remains stable But also becomes sort of surprising like Just adding this value request ID If you if you look at Sermon distributor And Let's close out here This is again This is not only for custom fields But since we are on This explore process if we go to main menu [00:57:37](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m37s) And let's say we wanna create a Field for the sermon menu sorry and let's say we gonna do Series now you see that there is a whole bunch of values here Look at that Whole bunch of values From sermon distributor In relation to the series And they all said Global Panel Box I mean this is a stunning feature right and it's Very easy to do [00:58:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h58m11s) Because all that I had to do to get those features there is to take this list query ID This value Is what actually makes this a selectable item In the menu so if I Go back here You see I have a series and you can select Test The way that JCB set this selection option up Is just by me adding this Request ID [00:58:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h58m45s) to To this field name Ok that's how that happened Now how did I get all the rest of the values These on the page as well Let me show you the way to get All the fields that you add to the config for example this We were looking at which one were we looking at the series [00:59:08](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h59m08s) The way to get all the series Fields That your add here To show at the menu is the fact that this name matches the site name That's how it works And if there is a field here That you do not want to actually have load here There is a way to do that so I'm gonna demonstrate that quickly As part of custom fields in a way So let's say I don't want them to set the default icon here anymore [00:59:40](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h59m40s) Then I want it always just fall back on the global Then I can actually Go to Let's see close out here Here is the series default icon I can scroll down and there is this Extra properties I can say add I can select display Now display switch for dynamic placement in relation to use of the field in menu and global [01:00:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h00m15s) configuration options So the config option will only add the field to the global configuration area Many will add the field only to the menu area and if you don't add this it will add to both So if we only want it to be in the config area We basically just add this value here Now Let's save and close and compile to show you How it Took it out and now let's go back there and let's create [01:00:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h00m58s) a new menu That's again look at sermon Distributors series And now we see that the Icon is missing here no longer showing up Where are we If we go to the sermon distributor global area And to series We'd see that the icon is still there So all the rest of these values [01:01:26](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m26s) are Showing except this one and this one Ok so Now let's Tweak A Little More Let's instead of config Let's say only menu I want value only in menu save And then compile It install then go here refresh And there we have it Now it's here [01:01:54](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m54s) And if we go back to sermon distributor and refresh It's no longer here So that's how you can control The reason why all these buttons are here is because it's under this tab the reason why all these buttons are here it's because It is this this view name series's is the same as this tab name series's That is how the connection is made that's how the buttons gets move and if you Don't want a button here Then This extra Display [01:02:31](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m31s) Option here can toggle where you want that button to show up And is to say none will let the button show up on both Ok well we're almost over an hour now I've said quite a lot of things I don't know hopefully this will help you understand little more about custom Fields and it's amazing Agility and ability To bring relationships together Let me think is there something else Yeah there is one more thing let me do that In the components admin [01:03:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m12s) View You can add what we call a linked view Right So I am doing that here In the sermons Basically in the preacher Admin View I am linking the sermon On tap 2 so I'm giving it the name And Did the child key That means the place where we getting the data [01:03:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m43s) No no wait a minute The the one who The View is sermon And in the Sermon table there is a column called preacher And that column preacher Is a custom field right And we decided that that custom Fields save the ID Of the preacher so the field name is Therefore preacher where is the value in the current [01:04:23](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m23s) Table Which is again here Preacher Is going to be the ID right This is the relationship between these two areas And then the placement Whether is going to have what kind of button Add new new and close button or add new or close button or just a new button These are some of the features that is available So [01:04:52](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m52s) Now sometimes it happens that you have a multiple selection and you still want to Set this relationship So there is a way to do that if it's a multiple selection so let's say this sermon could belong to more than one Preacher which in this case is not but let's just for a moment say it can Then you could do this. Wait. That Just that without anything else that will mean that it will now check whether This ID is in the array of this value If this array is a Associative array so let's say you have the value but it's in an associative array [01:05:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h05m43s) And Dissociation is maybe Key then you do that so if the array looks like this So if it looks like that Then You wanna target that area Then you would do The key If you are targeting a More than one [01:06:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h06m12s) Value so if it's this or that one We have an one called or So it could be Preacher or Let's say maybe have a teacher You can say or Servant Maybe these are the columns That mapped to this ID You can have the or [01:06:41](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h06m41s) In there And it can link multiple values But ok I think I'm going way over the edge here it's not really custom code The custom Fields so much there but Because custom fields are the majority of the time used To set up this relationship right You you set up these relationships With custom fields That is where that Livability comes in [01:07:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h07m12s) And The linking of a table into another one Ok Well thanks for watching In an hour of your time hope it's been worth it Thank you. \ No newline at end of file + 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 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's `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 extention options + +To know what is all the available extending options we go to Joomla Component Builders 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 is these three options you can extend that as 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 have a list of things in [00:06:20](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m20s) another table then you to populate the `getoptions` function. + +### Code required for Get Option funtion + +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'and this for the 'radio'. It's 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. And if you don't know what all the field types are that exist in Joomla then a good place to start is to go to field types and check out all these and if that is still not clear you can go to this URL. This has a list of all Joomla's field types so you could [00:08:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m43s) open that, scroll down and here is a list of all the field type names that you can't use again. It will be conflicting because it will break that name in that form. Do not use names that are not used by Joomla. Going back to creating 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 fall 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 you know. + + + Then the name here This name again is actually the code right That we know this is the type this is what is going to be To be new unique the rest is sort of the same as everything else multiple the default value because it's dynamic It's not really practical But it's really gonna be whatever you choose to be the ID of this Memory right [00:10:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m11s) Required read only this is all &&&&&ok extend here you make your choice what kind of Field do you want to create Then button 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 I was seeing that the button says true And then when I go to the code I don't see the button code in here And I was wondering ok what's 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 there 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 the leader if you will The one who decides how things happen So that if you change that one the field type updates where is 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 prime PHP and make that one so here is a little explanation of that So you wanna be sure this field Called preachers Should be the dominant and you wanna say I want the buttons to be true And now you save and compile You you will get what you expect And so that's another feature of custom fields that people are not aware of this feature but it's it makes it very useful [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 get input And that's really how the button gets added so basically asks Get the attribute button it checks if button is true If button is true Then it already got the parent HTML which is what The button the whole field is in this HTML Then we do some Because 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 done on the other page So this is what it does here it checks if there is a Referral And also we've added the return value As well so if there is a return value We are going to detect it oh no, wait, sorry We are building a return value as well that's right Ok so we come down here And we're starting to build the button so there is the the button being built [00:13:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m44s) And that is to create And then there's also one now You see that if the button name Preacher Or preachers Is Is the same as the area to which you are The preacher..... OK because this this inputs name is preacher right If we go back here [00:14:17](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m17s) This is called preachers right and down here We have a view called preacher and preachers So that is the Single View Right Single View name of the place the field is added And this is the listview so we are grabbing the field data from the preacher View and it's list name is preachers so It's the table where the data is being captured from Not the table where you gonna 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 taking 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?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m40s) Because it gives us a dynamic value which we can use in In many places including here You see a list button gets added to a page as well if we If we look back here at this implementation we see that here is a list Again But this isn't even in the view This is in the list View So you can Have a filter Dynamically in place for this again in the batch as well if you if you select batch [00:21:16](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m16s) There is also one available to select so all of these fields Are still using the information that we give here So if you don't have this information then some of these Fields functions will just Disappear It will Most probably not break But it will not be there so if you to see the fields filtering option is not working then it's because of these settings that are not right Now to give you a perspective on how it adds that This little [00:21:53](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m53s) Drop down here how does it do that Well in the code again if we go to that View Which is the plural preachers And we scroll down We have a Function Called here it is Filter [00:22:20](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m20s) Ok so we go up And we see There's a preachers one Import data What is the buttons filters Looking at the wrong one I should be looking at Sermons So here we have a load field type [00:23:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h23m43s) Preachers And it basically gets options see So this is really targeting This Options area this get options it's calling that function And Then if we have values it actually adds them into the filter And it checks are we doing badge and if this can create can edit validates Yes then it adds it to the batch as well [00:24:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m15s) So We are falling back onto the field type get options even in your filter And so That's why we have the filters easily integrated and it's the value is still use Using The Values that you placed in the field So That's how we get this value that's how we get that value Yeah that's basically it [00:24:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m46s) Ok next We have the components name now the reason why these can be dynamic Is because The table as well as the component name It is possible for you to reuse fields in different admin views and different components and then that can be dynamically update it And it should just work when you want to have a relationship from one Table into another component altogether Then you have to hard code [00:25:21](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m21s) Component a So let's say you have component a where you have a view adminView where this field is used And you want to take the data From That View Into another Component altogether Then you have to add component a's Static name in here and not the placeholder ok that's enough of that there has been discussions on [00:25:51](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m51s) forums about this so you could search up and find answers I suppose Then we have a field value and a key field Value field and key field I should have maybe given this different names I suppose because Basically the key field is the ID field Down here that place holder is the same as here and I'm actually saying it over there The field value Is the text value Over there Now [00:26:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m25s) The code text Is basically This text value again But it didn't gets placed over here so this and that value is basically the same value this is just the one that gets taken to the code Well it's what becomes available in the item So You could Change this to whatever you like this place holders are there only to make your life easier If it doesn't help then just replace them with static values [00:27:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m00s) But the advantage of them being like this is you can come up here and decide I no longer want to store the ID Because this is the value that get stored right it is the value that is over on this side J HTML method setting up an option Takes the second value which is this one has the value that get stored in the database and the third the Value as the value that gets shown in the drop down list So these are the two values that you're working with Now you can add here any PHP you like I mean you could you could grab from any other table you could do a very complicated query here and Generate a whole different list [00:27:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m44s) And just make sure that the ideas are not going to Clash And if you expect ID clashing then if you need to add Maybe ID underscore something for one Place's information ID underscore something else for another place's information you could do that because Because this this selection concept We'll keep on using this pattern all across JCB This is where you set The Relationship [00:28:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m15s) Inheritance structure everything this is just this area and it affects everything across JCB Wherever this field is going to be used This is going to be available So it always It means that you have a lot of Freedom in this little Block because that's what's gonna be at the end of day end up being placed here And You can Get from other tables you can do other and you know interesting relationships here But [00:28:49](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m49s) That is Important that at least the main table Is the one that you mentioned here And the main component is the one you mentioned here And it That Tables View and list views names are used here and then the value I mean in this table this one here You are grabbing two values you're grabbing a value to show to the user [00:29:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m19s) And value to save in the database that's the key value the key field that is the value Get stored in the database if you're using This implementation If you're not then this doesn't really Yeah you can just leave it out if you if you're not gonna use this You can hardcode whatever values you want down here it'll still work infact I would Encourage you to test it You know I have built Fields custom Fields which I left out All of this information [00:29:59](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m59s) And only did everything in here And It still worked Because I was actually having such Dynamic value retrieval based on so many other concepts Of the current view I even grab the ID from the from the input to determine the Get relationship so They are very nice Options let me show you one of those fields Here is the field it's called member it's an external I'm using it in a external component [00:30:34](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m34s) The field type is member Ok so I hard coded the table and the component names But down here in the option the get option You see I have a whole different set of PHP script Which Is using Custom help methods to check access It's also up here We were basically where is it Yeah I'm getting the input and I'm checking is there referral values to a field ID value and if [00:31:09](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m09s) there is it I'm using this This values Down into the searching and getting here it says Load the main member only You know there's all kinds of Tricks I'm doing and it's all happening in the PHP and I know That this PHP Is getting dumped Into this area here So the get options is what is being used across JCB for the field [00:31:39](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m39s) And so I'm able to do anything that you can with PHP in here To determine what the options must be for the custom field Always remembering that there needs to be in This area here the needs to be a value which I want to be placed in the database and a Value I want my user to see these values can Theoretically be exactly the same Like that I didn't have to be really doesn't matter [00:32:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m15s) You decide the only reality is if that's the value you place in the database that's the type of value You need to set up So if this is going to be a string This value here Then you need to come back And you need to Check That your database is not an integer Because if you saving a string you want at least have a Varchar about 250 [00:32:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h32m44s) Now that'll work But if you change the Multiple That means Can a user a select more than one value if you change that true Again you need to change your database to at least text to Be able to store or a very big Varchar which is also possible To store these values if they are gonna be strings then I usually just use text I just like it [00:33:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m18s) Easy enough And if it's going to be lots of options you can go bulk ,there is even way more than I think you would ever need but ok so The reality is we can determine what these values are so here I'm making sure that the member value is an ID But I'm using a helper method To take this ID And get the members name Why because the member's name is difficult to know because it could be different values based on the [00:33:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m58s) Different member types some members there having their name in the user table some members they have in there names in the members table So that's different places the members name can actually live So with this little function I wrote in the helper class I can determine the members name by simply the ID Or I could add the user and the name and it makes it quicker to for the function so this function has Little bit of a speed up if I have these values available but like over here I don't so I only pass the ID and It still works And so This is the maneuverability of a selection [00:34:44](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m44s) You can adapt this to whatever you want the only reality is that the moment you set Your I would call it convention Of this field type Then you need to honor that Convention across your component If you decide that you're saving a string in that field Then you need to everywhere now you dealing with the string If you're saying you're saving a multiple select then you might wanna Do You know the default storing method usually works Out of the box [00:35:19](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m19s) If it doesn't you can come and try Json Especially when you have multiple values but usually it does it out of the box and I can show you why If we go to the compiler We go to the fields Class in the compiler it has a function called set Builder Now the set builder function is really a little oversized at the moment it started out Small believe me And I could See the option of decoupling some of this out into its own separate methods but It works very well and it's easy to understand so [00:36:00](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m00s) If I just collapse this here we can see more So now we come down here we ask what is the data type Is it set And if it's set we determine Through various methods ok This is what we have and we go ahead and we set database keys and all kinds of database relationship information query builder gets updated with a lot of information and stuff So the database information gets used up here If we have ....... it is a different concept [00:36:39](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m39s) if we scroll down We wanna look at the storage switches So coming down here Where we get to setup checkbox and other joint items for this view We are basically Going to check What type of field is this If it's a subform if it's check boxes Or if the store method is not zero which is default If we have a database switch [00:37:17](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m17s) And That it's not a tag the type name Ok now we coming here if it's any of these fields It will check if you set your own storage Switch Obviously if none is set it will fall back onto the Json It needs to be Json If it one of those fields So it automatically builds it so that means the default will be Json then if you select Json it It will still be Json [00:37:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m45s) So that's just how this catch works if you don't know it should be we will In the compiler sort of help you Get to the same place Now That also means that sometimes You might have a multiple select option in a list field which is not a subform not check Boxes But it's multiple The multiple gets triggered the multiple switch so it will still come in here So what even if you set [00:38:22](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m22s) it to be Json Where in the compiler have the multiple Switch to check is this field having multiple selection Yes well then we need to save save it as a Json That is what this does so takes care of the fact that it's Json but It mustn't be a tag and it must have a database switch and database which just means the data Must be going to be stored into the database if there's no storing of the data in the Database we obviously don't need any of this. So the multiple switch If we search it up We'll see that it actually gets passed [00:39:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m07s) To the builder right there one of the it's parameters We go and search Where the Builder all is used will see that the multiple switch is also in a variable So we can go up and you can search You can search for this where does multiple get set Ok so we started of This this method Didn't start with multiple so that scroll down let's see Where is multiple come from [00:39:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m43s) There's multiple And it's set to False to start with Ok So we're in the beginning of set the dynamic field We check multiple is false then we get set field attributes and multiple gets passed to it Let's check field attributes we go let's go to the actual function We see here comes multiple but it's passed with a reference that means he whatever we do to this value In this method We'll go back to where it started So over here [00:40:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m15s) We doing a check At some point Let's see we got Properties Validate Let's search that the variable multiple That's go ha Here we found the property name which is multiple We retrieve the value From the XML Check that the value gets added here and we check is that value true and if it's true we trip the switch [00:40:50](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m50s) To multiple so that literally gets down the through what you put into the JCB Interface This little Field Where is it If you Set this to True it will trip that behavior So that's how that works So the multiple switch is a powerful switch and it Really helps you even if you miss [00:41:21](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m21s) The the storage Obviously it doesn't update the database Selection but if you miss the storage thing The default will work Ok But if you did that it will still work even if you select one of the encryption options it will Still work Because it actually is a little bit intelligent Ok so if we go back here And we go back to the [00:41:52](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m52s) Set Builder The set builder function is one of those places where you could figure out a whole lot of things About how they JCB compiles Custom fields So this is a good place to start you know your search The other one that we already looked at is the set attribute This one here The set attributes is where we actually work with the original values that we get from the database the properties As well as the actual field So [00:42:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m28s) We use the field value to determine many things And we parse every value, the reason why we remapped this is to make sure we can Sort of fix things if you made a mistake So there is some some things here to try and catch Any Human error on the side of JCB that also means you could be doing something wrong and things still work That happens And then someday maybe someone decides no they don't want to catch that fix anymore You know which I'm trying to [00:43:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m07s) You know prevent I wanna keep the The fixing place And then suddenly your Project Doesn't work I'm trying to avoid that But it's good to know how it must be done Right So you just do it that way To start with [00:43:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m25s) Ok So That is Basically a little bit of that, let's go back to the field Suggest in conclusion You could add any kind of code here Basically it is what gets The list and it's with this string here That you are adding options to the list so basically in this little chunk here Basically you check do I have the items if yes you can decide if you want to put a placeholder you [00:43:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m58s) See there select a Preacher if we go to sermon And We We see that it's first option is select a Preacher And it is basically this little snippet here that does that So you could You could do that now The When you do multiple select Then this [00:44:23](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m23s) Doesn't work well just take it from me If you up here Chose To allow multiple Where is it here True Then I would suggest you take this option now [00:44:37](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m37s) Because it will be look like an option to select it won't Behave the same as now Where you actually click away and it's gone it will be an option and The option is a blank there's like a no string That is how We detect That it's empty It's this no string value here Ok so That is what that is up there and then you start looping this t forward slash is basically [00:45:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m07s) A tab so you could put an actual tab in there The way I do that is I would go to you copy a tag from here copy go back And paste it in And You could do this In fact Most of the time this is the better way to To make the code look [00:45:32](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m32s) Beautiful And Correctly spaced This is This is often what I do Is I move all the code Just one little knots In fact I think I needs to be two So I move it all Like this and I know it sounds Crazy But that is what I do [00:45:56](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m56s) So now the code will look very nice and good in the display If I save it Let's Let's make a little comment here Hi there and then This is set to be the prime so save and close And now we can Go and compile this Install [00:46:28](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m28s) And in our preacher table we have that little hi there And unfortunately the first value should not have a space Yeah the spacing of Of field types is still well many areas actually in JCB It's like where we're at a place where I don't know how we will be able to fix this So that it always behaves sort of better like that is now with you I need to do to get that space in just right And I I know that feels a little Wrong place That feels a little Uncomfortable [00:47:10](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m10s) But it's really It's difficult to catch it correctly for every Implementation So Currently That's the work around so if we compile it and we go back We check it's Now it's correct And there's our little note [00:47:34](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m34s) So our spacing is working out If you didn't add the space it will Sometimes work out something like that That's how it look Ok Which still will work it just doesn't look nice So on this view we have this as a custom field this is a custom field This is category field the tag field And this is a custom field [00:48:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m07s) So we have Many different Custom fields Which is quite nice List folder this is a custom field a multiple select Custom field External This is a custom field This is a custom field So [00:48:29](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m29s) There are many custom fields on this page And you can actually In JCB when you've imported sermon distributor If you don't know how to do that There are tutorials Maybe the best quickest path to showing you that it's just JCB import Then VDM packages How to get Free keys from VBM [00:48:56](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m56s) Because sermon distributor Is one of the three packages There are many free packages not all of them are Free like these are not free But They are even component builder is one of the free packages that you can get a key for So you could click here go get a key I tell you the the The way that we have Build components [00:49:23](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h49m23s) In JCB And all the fields that we've used I mean you can come here you can go to Preacher And all those custom Fields that I just clicked They are here Wait this is not the right one sermon This the one had so many So it's this one To come to Fields and here they are that's custom [00:49:50](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h49m50s) That one is custom This one This one You could click this local file list Wanna see how to list and local file list With a custom field Well this is how I did it I don't even have look here There isn't even Any Table here [00:50:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h50m12s) There's even the button is false Extend list yes I doesn't have a table doesn't have a component none of that I just dumped it And I you see the first one is Back there Now I get parameters I first get the folder path from the global so if you want to see for Example oh how did he set this how to get this setting while let's go out of this would come back here again And out of this Then let's go to the component [00:50:47](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h50m47s) And you'll see that there is a component config area we open that Going of the path a bit but just bear with me And one of those Fields Let's see set up here no it's sermon s there's obviously many in this one Sermon Let's see Sermon menu sermon panel box Sermon media [00:51:27](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h51m27s) Sermon Ok it's not down here execution time Download So It was up here all along Local folder path So it's a It's a text area Which is in sermon tab so if we go here and we click options There is a sermon tab and there it is local folder path so you can set the local folder path for this [00:52:01](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h52m01s) Where the local files are going to be placed And It is because of this file here This field Now if you wanna check the fields check the spelling local folder path close it out And go to fields And type in Local Local ok [00:52:35](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h52m35s) Oops So there it is this a text one we select that Are you can see how I built that Simple field type For the hint Nothing fancy Now I'm going back to our field If we Go back to the field we were looking at We go back to admin View [00:53:02](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m02s) We don't need to go into the sermons But ok that that is a easier way right so we go in here Now we go get into local file Open that So basically in our component We checking this components value for local folder and if it hasn't got one we fall back unto images The image path And that's where we start Now We do a first option [00:53:33](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h53m33s) Which is please add files and we take the local folder path result And we pass it into here into options Now Then we load the file import Ops classes And we check does the folder exist If it doesn't we create the folder Now check if there is files in the folder So we do get files This is the Function in Jfolder [00:54:04](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h54m04s) And If it's true We actually take the files and we Reset the get options because remember up here we told it to add files but now here with this we reset basically the Options variable And now we start loading the files and then we give it back And so we used both value here see file and file Which is actually very easy way to To do a local folder setup [00:54:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h54m36s) And make people select now again we just looking at demo Component we just looking at it external source manual file is also custom how am I doing this Well it's quite complicated thing so it is a Basically I'm using a helper class get external source link And I don't again look at that there is no table There's no no external component There's nothing Just [00:55:10](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m10s) Just these values go look at it if that's all it is there and it's working that should tell you that you could do the same And get it to go because this is the actual issue this result That's what we need to have correct So having looked at this or get external links source while that's an helper Class how is that close that out Helper classes are stored in the component area So you go to Joomla components Go into the component And you go to libs helpers And here you can scroll down [00:55:49](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h55m49s) And get download links is a big method get We should have Copy that So here is a function get external source length and has a few arguments And it does a few other get externals listing And does a few trip switches here And That's how I eventually return [00:56:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m18s) Something to that function And We get that list Ok so That's how you should take demo components and Sort of decipher it's implementation structures and don't think it's more complicated than That it isn't it's really simple JCB is very Resilient It can [00:56:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h56m43s) Adapt itself to Specific implementations So the custom field Is my opinion one of the fields I Have enjoyed Extremely very much And I'm using it all the time everywhere And I am constantly making sure trying to ensure that it's behavior Remains [00:57:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m07s) Yeah remains stable But also becomes sort of surprising like Just adding this value request ID If you if you look at Sermon distributor And Let's close out here This is again This is not only for custom fields But since we are on This explore process if we go to main menu [00:57:37](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h57m37s) And let's say we wanna create a Field for the sermon menu sorry and let's say we gonna do Series now you see that there is a whole bunch of values here Look at that Whole bunch of values From sermon distributor In relation to the series And they all said Global Panel Box I mean this is a stunning feature right and it's Very easy to do [00:58:11](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h58m11s) Because all that I had to do to get those features there is to take this list query ID This value Is what actually makes this a selectable item In the menu so if I Go back here You see I have a series and you can select Test The way that JCB set this selection option up Is just by me adding this Request ID [00:58:45](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h58m45s) to To this field name Ok that's how that happened Now how did I get all the rest of the values These on the page as well Let me show you the way to get All the fields that you add to the config for example this We were looking at which one were we looking at the series [00:59:08](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h59m08s) The way to get all the series Fields That your add here To show at the menu is the fact that this name matches the site name That's how it works And if there is a field here That you do not want to actually have load here There is a way to do that so I'm gonna demonstrate that quickly As part of custom fields in a way So let's say I don't want them to set the default icon here anymore [00:59:40](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h59m40s) Then I want it always just fall back on the global Then I can actually Go to Let's see close out here Here is the series default icon I can scroll down and there is this Extra properties I can say add I can select display Now display switch for dynamic placement in relation to use of the field in menu and global [01:00:15](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h00m15s) configuration options So the config option will only add the field to the global configuration area Many will add the field only to the menu area and if you don't add this it will add to both So if we only want it to be in the config area We basically just add this value here Now Let's save and close and compile to show you How it Took it out and now let's go back there and let's create [01:00:58](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h00m58s) a new menu That's again look at sermon Distributors series And now we see that the Icon is missing here no longer showing up Where are we If we go to the sermon distributor global area And to series We'd see that the icon is still there So all the rest of these values [01:01:26](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m26s) are Showing except this one and this one Ok so Now let's Tweak A Little More Let's instead of config Let's say only menu I want value only in menu save And then compile It install then go here refresh And there we have it Now it's here [01:01:54](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m54s) And if we go back to sermon distributor and refresh It's no longer here So that's how you can control The reason why all these buttons are here is because it's under this tab the reason why all these buttons are here it's because It is this this view name series's is the same as this tab name series's That is how the connection is made that's how the buttons gets move and if you Don't want a button here Then This extra Display [01:02:31](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m31s) Option here can toggle where you want that button to show up And is to say none will let the button show up on both Ok well we're almost over an hour now I've said quite a lot of things I don't know hopefully this will help you understand little more about custom Fields and it's amazing Agility and ability To bring relationships together Let me think is there something else Yeah there is one more thing let me do that In the components admin [01:03:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m12s) View You can add what we call a linked view Right So I am doing that here In the sermons Basically in the preacher Admin View I am linking the sermon On tap 2 so I'm giving it the name And Did the child key That means the place where we getting the data [01:03:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h03m43s) No no wait a minute The the one who The View is sermon And in the Sermon table there is a column called preacher And that column preacher Is a custom field right And we decided that that custom Fields save the ID Of the preacher so the field name is Therefore preacher where is the value in the current [01:04:23](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m23s) Table Which is again here Preacher Is going to be the ID right This is the relationship between these two areas And then the placement Whether is going to have what kind of button Add new new and close button or add new or close button or just a new button These are some of the features that is available So [01:04:52](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m52s) Now sometimes it happens that you have a multiple selection and you still want to Set this relationship So there is a way to do that if it's a multiple selection so let's say this sermon could belong to more than one Preacher which in this case is not but let's just for a moment say it can Then you could do this. Wait. That Just that without anything else that will mean that it will now check whether This ID is in the array of this value If this array is a Associative array so let's say you have the value but it's in an associative array [01:05:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h05m43s) And Dissociation is maybe Key then you do that so if the array looks like this So if it looks like that Then You wanna target that area Then you would do The key If you are targeting a More than one [01:06:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h06m12s) Value so if it's this or that one We have an one called or So it could be Preacher or Let's say maybe have a teacher You can say or Servant Maybe these are the columns That mapped to this ID You can have the or [01:06:41](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h06m41s) In there And it can link multiple values But ok I think I'm going way over the edge here it's not really custom code The custom Fields so much there but Because custom fields are the majority of the time used To set up this relationship right You you set up these relationships With custom fields That is where that Livability comes in [01:07:12](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h07m12s) And The linking of a table into another one Ok Well thanks for watching In an hour of your time hope it's been worth it Thank you. \ No newline at end of file