From 5b718a29fd6730d4d5ba76298fb22d655ce73947 Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Thu, 31 Oct 2019 13:33:21 +0200 Subject: [PATCH] Updated 073 JCB Fields Type Extended (markdown) --- 073-JCB-Fields-Type-Extended.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/073-JCB-Fields-Type-Extended.md b/073-JCB-Fields-Type-Extended.md index eea9b41..37d84c7 100644 --- a/073-JCB-Fields-Type-Extended.md +++ b/073-JCB-Fields-Type-Extended.md @@ -63,43 +63,47 @@ We will get to these again. Just wanted to [00:15:28](https://www.youtube.com/wa We are able to target the admin area with this kind of button. If we have a button, we add the button declaration to the document. Then we add the buttons to the field with this input append. This class here, is a Joomla class. Which means we are falling back on their implementation on how to add a little tweak to the field. That is how the button gets added and how it works. You can go through this, I mean it is quite simple. It's very easy code. This implementation is to make sure that the button name follows the convention and naming convention. -### HTML and JavaScript Sets Up the Button +### HTML And JavaScript Sets Up The Button [00:17:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m46s) - That's the HTML and JavaScript that sets up the button. The reason why you would sometimes see the edit button there and sometimes not, is about the relationship here. The `buttonName` must match one of these(`preacher` and `preachers`). If it doesn't, it won't add it. That is if you want to have a [00:18:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m18s) button that already knows where we are going. How can I know those values? At the moment the only values we have, are these values it's come up here. These values(see video). We don't have other values. This is the values we have, the view ID. That's what we have to work with. If there's no relationship then how can we set the edit button? The relationship must be set. +That's the HTML and JavaScript that sets up the button. The reason why you would sometimes see the edit button there and sometimes not, is about the relationship here. The `buttonName` must match one of these(`preacher` and `preachers`). If it doesn't, it won't add it. That is if you want to have a [00:18:18](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m18s) button that already knows where we are going. How can I know those values? At the moment the only values we have, are these values it's come up here. These values(see video). We don't have other values. This is the values we have, the view ID. That's what we have to work with. If there's no relationship then how can we set the edit button? The relationship must be set. -### Set a Relationship +### Set A Relationship [00:18:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m46s) - This is the way we set a relationship. It is quite simple. You must make sure that the name of the button, in this case this specific one will not work although we set the button to be 'true', it will check the name and see this does not match and it will not add a button. That's good because we do not want a button here. We want a button to show up in Sermon Preacher. When it loads this(preacher) button it will check the name, it will say this one matches and it will add a button. That's the right behavior, that's what we want. If we compile it. [00:19:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m36s) Go to sermons, click:'_ Behold he prayeth_'. We will see it has an Edit option. If we select none it has a create option, select:' _Leonard Ravenhill_', it has a Edit option. That is how that relationship comes together. We go back to the field. [00:20:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m07s) We have the buttons set. That's really the whole discussion. 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. It will take the button away completely. +This is the way we set a relationship. It is quite simple. You must make sure that the name of the button, in this case this specific one will not work although we set the button to be 'true', it will check the name and see this does not match and it will not add a button. That's good because we do not want a button here. We want a button to show up in Sermon Preacher. When it loads this(preacher) button it will check the name, it will say this one matches and it will add a button. That's the right behavior, that's what we want. If we compile it. [00:19:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m36s) Go to sermons, click:'_ Behold he prayeth_'. We will see it has an Edit option. If we select none it has a create option, select:' _Leonard Ravenhill_', it has a Edit option. That is how that relationship comes together. We go back to the field. [00:20:07](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m07s) We have the buttons set. That's really the whole discussion. 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. It will take the button away completely. -### Table value is a Mandatory Value +### Table Value Is A Mandatory Value [00:20:36](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m36s) -This table value is a mandatory value. Because it gives us a dynamic value which we can use in in many places including here. A 'List' button gets added to a page as well. If we look back here at this implementation, 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 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. +This table value is a mandatory value. Because it gives us a dynamic value which we can use in in many places including here. A 'List' button gets added to a page as well. If we look back here at this implementation, 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 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 is because of these settings that are not right. +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 is because of these settings that are not right. -### How it adds the Drop Down +### How It Adds The Drop Down [00:21:27](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m47s) - Now to give you a perspective on how it adds that Drop Down. In the code we can go to that View which is 'Sermons'. Here is `loadfieldtype['Preachers']` [00:23:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h23m43s) and it `getsoptions`. So this is really targeting this 'Options' area. It calls that function and if we have values it adds them into the filter(`addfilter`) And it checks are we doing `badge` and if this can create, edit or 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 on the field type get options even in your filter. That's why we have the filters easily integrated and it's the value is still using the values that you placed in the field. That's how we get this value. +Now to give you a perspective on how it adds that Drop Down. In the code we can go to that View which is 'Sermons'. Here is `loadfieldtype['Preachers']` [00:23:43](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=74&t=137s&t=00h23m43s) and it `getsoptions`. So this is really targeting this 'Options' area. It calls that function and if we have values it adds them into the filter(`addfilter`) And it checks are we doing `badge` and if this can create, edit or 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 on the field type get options even in your filter. That's why we have the filters easily integrated and it's the value is still using the values that you placed in the field. That's how we get this value. ### The Component Name [00:24:46](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m46s) - Next we have the components name. The reason why these can not be dynamic is because the table as well as the component name because it is possible for you to reuse fields in different admin views and different components and then that can be dynamically updated and it should just work. When you want to have a relationship between one table to another component altogether then you have to hard code component 'A'[00:25:21](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m21s). 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. There has been discussions on forums about this so you could search up and find answers.>>>> ,,:) +Next we have the components name. The reason why these can not be dynamic is because the table as well as the component name because it is possible for you to reuse fields in different admin views and different components and then that can be dynamically updated and it should just work. When you want to have a relationship between one table to another component altogether then you have to hard code component 'A'[00:25:21](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m21s). 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. There has been discussions on forums about this so you could search up and find answers. -### Field Value and a Key Field Value +### Field Value And A Key Field Value(See Video) [00:25:54](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m54s) - 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 ids 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 +Then we have a Value field and key field. I should have maybe given this different names. Because the key field is the ID field. Down here that place holder is the same as here(see video). I'm saying it over there: The field value is the text value over there. [00:26:25](https://www.youtube.com/watch?v=91iIAuHZj38&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m25s) The code text is this text value again. But it didn't gets placed over here. This and that value is the same value. This is the one that gets taken to the code. Well it's what becomes available in the item. You could change this to whatever you like. These 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 ids 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