Table of Contents
- JCB FIELDS TYPE EXTENDED
- Custom Fields Connect A Table From One View To Another
- Custom Fields A Joomla Concept
- Where To Find The Available Extension Options
- A Portion of Code Required For Get Option Function
- Where To Find A List Of All Joomla's Field Types
- The Button Feature
- Get Input(How Button is added)
- Able To Target The Admin Area With This Kind Of Button
- HTML And JavaScript Sets Up The Button
- Set A Relationship
- Table Value Is A Mandatory Value
- How It Adds The Drop Down
- The Component Name
- Value_Field And A Key_Field Value(See Video)
- Very Nice Options
- JSON - Function Called setBuilder
- Multiple Selection - Not A Subform - Not A Checkbox - Multiple Switch Gets Triggered
JCB FIELDS TYPE EXTENDED
00:00:00 (Click on these time links to see Youtube video)
I would like to give a demonstration and maybe some explanation about the functionality of a Custom field. Some tutorials about this had been given in the past but JCB has improved and there the area has bit of a different look. Let me do this again and show in the Compiler how it actually functions. Here are a few views. 00:00:46 I've imported Sermon Distributor which is the most common demo component that I have used which has a few Custom Fields. I could actually change this(Follow on video). This one is changed to Custom and here is a few Custom Fields . The idea was that you would 00:01:15 use the demo components and then figure out how their Custom Fields work.
Custom Fields Connect A Table From One View To Another
First of all Custom Fields is a way to connect a table from another view of course into another view. Then you can have more than one Custom Field in a table and you can do that to build relationships. You could even take different tables and create a different combined list of values. You can really do anything with Custom Fields, it is maybe one of the most powerful Field types in JCB.
Custom Fields A Joomla Concept
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 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 using the field name in your XML.
If you look at the form and let's say we use Sermon, you will see that in the XML at the top we have addfieldpath
and it can be seen that it ends in the model because of how we do it, it expects it to be here. 00:03:44 That's why it knows to go and search 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 It's like the comment it does not do anything. So you can come here in the Fields area and there is 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. 00:04:36 Here we are extending the list option(JFormfieldlist
).
Where To Find The Available Extension Options
To know what is all the available extending options we go to Joomla Component Builder's file and go to the Compiler and to Joomla 3, then scroll down and there is the 'checkboxes' option and there is the 'Field list', the 'Field radio' 00:05:08 and the 'Field user' but the Field user we have made a whole Custom field to just target the Field user. Concerning the 'checkboxes' and the 'radio': If you go back to JCB and create new and select 'Custom' you would see that at some point it asks what you would like to extend. 00:05:41 And here are these three options you can extend as a List, as a Radio button or as Checkboxes. That is what this 'Extend' is for. So that is currently the only 3 that is ready to go into JCB. There are of course others but then we will have to expand JCB. If you are using a form list which is the most common one because you want to have a list of things in another table then you have to populate the getoptions
function.
A Portion of Code Required For Get Option Function
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 In JCB you are just adding this part for the 'List'. For the 'radio' it is also just the getoptions
. For the 'Checkboxes' again also just getoptions
. So it is basically the only code we need to have. It is only with the user one 00:07:08 that 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 in this area. 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 it and then take your changes back to the view in JCB and just place it in Custom. That means that the type is movable because it is new but it must be something that doesn't already exist in Joomla.
Where To Find A List Of All Joomla's Field Types
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 open that, scroll down and here is a list of all the field type names that you can not 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 create a Custom Field. 00:09:12 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, it's just to see what is the field. You can call this anything. It only falls back to this name if there isn't a label set here, then it will fall back to this name(Follow on video). 00:09:39 But the ideal is to just set the label.
The name (see video) is actually the code. This is the type and this is what is going to be unique. The rest is multiple, the same as everything else. As the default value is dynamic, it is not really practical but it is really going to be whatever you choose to be the ID of this memory. 00:10:11 'Required', 'Read Only', etc. In this(see video) area choose what kind of field you would like to create.
The Button Feature
Then the 'button' feature is one of the features that are quite exciting. Let me show you some of that. A strange behavior occures here; the button says 'true' but in the code the button code does not appear. I was wondering what is going on here and then I remembered that when JCB detects that 00:10:48 there is two Custom Fields with the same type, it only uses one for this(the php for the getOption method) area and for the button because one of them will to be the dominant one. 00:11:12 You can decide which one it is and if you want to share the field type among multiple Custom Fields and if you want to reuse that field type, you can. You want to make sure that one of them is the one which you know is going to be dominant, the one who decides how things happen. So if you change that one, the field type gets updated. Whereas if you change the wrong one it doesn't do anything. So just one of those will be the 00:11:47 the dominant one. You can do that by making it the prime PHP and make that 1. Next to it is a explanation of that. If you want to be sure this field called 'Preachers' should be the dominant and you want to say; I want the buttons to be 'true' and if you then save and compile, you will get what you expect. That's another feature of Custom Fields that people are not aware of but it makes it very useful.
Get Input(How Button is added)
If we now go back to the code, we see a new set of a script called getinput
. That's how the button gets added. It asks getAttribute('button')
, it checks if button
is true
. If button is true
, then it already have the parent HTML
(the whole field is in this HTML). If you have a button and someone clicks on it, you might want them to 00:13:07 be redirected back to this page where the field is, once they are done on the other page. This is what it does, it checks if there is a 'Referral'. We are building a return value as well.
We come down here and we start to build the button. There is the button being built(See Video). 00:13:44 That is to create. This is called preachers, and down here we have a view called 'Preacher' and 'Preachers'. That is the Single View, the Single View name of the place, the field is added. This is the 'Listview'. We are grabbing the field data from the Preacher View, and it's List name is 'Preachers'. It is the table where the data is being captured from. Not the table where you are going to show the field but the table where you are taking the information from.00:14:55 If you take it from multiple tables, then you must choose a dominant table. The one that you want to be always available. That's what this is as well as you can see. It is usually the case that preachers and preacher values are the same. I decided to give the option to change the table name.
We will get to these again. Just wanted to 00:15:28 show you that if those two(preacher and preachers) line-up, the button name lines up with those two. It checks whether this current user has authority to edit buttons. We can go down and create and edit button. We can also write JavaScript to 00:16:01 give that button behavior. When you click change the field, it checks: Is it that value? And then it updates. You can check if this is JavaScript. This one up here is used to generate the create button and it also validates whether this user has create options, 00:16:30 and is the user in the admin area. Currently this feature is not available to the site area and it's because of many conventions in the site area, and so is custom. It will probably break this button. We will have to work at this but this is where we are at.
Able To Target The Admin Area With This Kind Of Button
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
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 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
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 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 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
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 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.
How It Adds The Drop Down
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 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 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
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. 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.
Value_Field And A Key_Field Value(See Video)
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 placeholder is the same as the key-field. I'm saying it over there: The field value is the ###TEXT### value over there. 00:26:25 The ###CODE_TEXT### is this ###TEXT### value again. But it didn't gets placed over in the ###CODE_TEXT###. The ###TEXT### and ###CODE_TEXT### value are the same value. ###CODE_TEXT### is the one that gets taken to the code. Well it's what becomes available in the item. You could change the ###CODE_TEXT### to whatever you like. These placeholders are there to make your life easier. If it doesn't help then replace them with static values. 00:27:00
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 key_field is the value that get stored. It is the value that is over on this side. The Jhtml method setting up an option, takes the second value which is this one, has the value that get stored in the database. The third value as the value that gets shown in the drop down list. These are the two values that you're working with. You can add any PHP you like. I mean you could grab from any other table. You can do a very complicated query and generate a whole different list. 00:27:44 Make sure that the IDs are not going to clash. If you expect the ID is clashing, you will need to add ID underscore something for one places information, ID underscore something else for another places information. You could do that because this selection concept We'll keep on using this pattern all across JCB. This is where you set the relationship 00:28:15 inheritance structure everything. This is an area and it affects everything across JCB, wherever this field is going to be used. This is going to be available. It means that you have a lot of freedom in this little block because that is what it is going to be at the end of day, end up being placed here. You can get from other tables, you can do other interesting relationships here. 00:28:49
It is important that at least the main table is the one that you mentioned here, the main component is the one you mentioned here. That tables view and list view names are used here. In this table, this one here, you are grabbing two values, you're grabbing a value to show to the user 00:29:19 and a 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 you can just leave it out if you're not going to use this. You can hardcode whatever values you want down here. It'll still work in fact I would encourage you to test it. I have built custom Fields which I left out All of this information, 00:29:59 and only did everything in here, it still worked. Because I was having such a dynamic value retrieval based on so many other concepts of the current view, I even grab the ID from the input to determine the Get relationship. There are very nice options.
Very Nice Options
Let me show you one of those fields. Here is the field it's called Member. I'm using it in a external component. The field Type is Member. I hard coded the table and the component names. Down here in the get option, you will see I have a whole different set of PHP script. Which is using custom help methods, check access. It's also up here, I'm getting the input and I'm checking, is there referral values, is there a field ID value, and if 00:31:09 there is, I'm using this values down into the searching and getting here. It says: Load the main member only. You know there are all kinds of tricks I'm doing and it's all happening in the PHP. I know that this PHP is getting dumped into this area here. The get options is what is being used across JCB for the field. 00:31:39 You are able to do anything that you can with PHP in here to determine what the options must be for the custom field. Always remember that there it needs to be a value what I want to place in the database and the value I want my user to see. These values can theoretically be exactly the same, like that. But it didn't have to be. 00:32:15 You can decide, the only reality is, if that's the value you place in the database, that's the type of value you will need to set up. If this is going to be a string, this value here, then you will need to come back and you will need to check if your database is not an integer. Because if you saving a string, you want at least have a VARCHAR about 250. 00:32:44 That'll work, but if you change the multiple, it means: can a user select more than one value? If you change that to true, again you will 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 going to be a strings, then I usually use TEXT. I just like it, 00:33:18 easy enough. If it's going to be lots of options, you can go bulk, there is way more than I think you would ever need. The reality is we can determine what these values are. 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 different member types. Some members having their name in the user table, some members have there names in the members table. So that's different places the members name can live. 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. This function has a little bit of a speed up if I have these values available. But like over here, I don't, I only pass the ID and it still works. This is the maneuverability of a selection.
JSON - Function Called setBuilder
You can adapt this to whatever you want. The only reality is that the moment you will set your, I would call it convention of this field type, then you will need to honor that convention across your component. If you decide that you're saving a string in that field, then you will need to know you are dealing with the string everywhere. If you're saying you're saving a multiple select, the default storing method usually works out of the box. 00:35:19 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. I can show you why. If we go to the compiler, go to the fields class in the compiler, it has a function called setBuilder. The setBuilder function is really a little oversize at the moment. It started out small believe me, I could see the option of decoupling some of this out into its own separate methods. It works very well and it's easy to understand. 00:36:00 We can come down here, we ask what is the data type? Is it set? If it's set we determine through various methods 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. 00:36:39 We want to look at the storage switches. Coming down here where we have setup checkbox and other joint items for this view, we are 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 And that it's not a tag, the type name. We are 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 is one of those fields. It automatically builds it. That means the default will be JSON, then if you select JSON, it will still be JSON. That's just how this catch works. If you don't know it should be, we will in the compiler help you get to the same place.
Multiple Selection - Not A Subform - Not A Checkbox - Multiple Switch Gets Triggered
It also means that sometimes you might have a multiple select option in a list field, which is not a subform, not checkboxes, but it's multiple. The multiple switch gets triggered. It will still come in here. Even if you set 00:38:22 it to be JSON, where in the compiler we have the multiple switch to check is this field having multiple selection? Yes, well then we will need to save it as a JSON. That is what this does. It takes care of the fact that it's JSON. BUT it mustn't be a tag and it must have a database switch. The database switch means the data mus be stored into the database. If there's no storing of the data in the database, we don't need any of this. If we search for the multiple switch, we'll see that it gets passed 00:39:07 to the setBuilder, one of the parameters. We can go and search where the setBuilder all is used. We will see that the multiple switch is also a variable.
???
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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.
- Home
- Beta Testing
- Custom Code
- PHP Settings
- Demo Component
- Tutorials
- Hello World JCB
- Intro JCB Guide
- JCB Installation Steps
- Planning Components
- Field Type Overview
- Basic Fields Creation
- Admin View Management
- Advanced Field Usage
- Admin Component Integration
- Component Setting Customization
- Scripting Components
- Component FTP Options
- Dynamic Get Method
- Site View DynamicGet
- Site View Templates
- Template Setup Guide
- Layout Configuration Steps
- Custom Admin Management
- Adding Site Views
- Custom Admin Integration
- MySQL Demo Tweaking
- Global JCB Settings
- Custom Time Field
- User Helper Integration
- Email Helper Usage
- Message Store Email
- List View Unescape
- Export Import Customization
- Overwrite Custom Fields
- List Field Filtering
- Automatic Code Import
- Manual Code Implementation
- Component Export Import
- Custom Admin Buttons
- Translation Management
- Site View Permissions
- Component SQL Updates
- Site Edit Configuration
- JCB Backup System
- Helper Structure Integration
- JCB v2.5 Upgrade
- Tab Setup Guide
- JCB v2.6 Release
- Extended HelloWorld
- Field Rule Validation
- Community Snippets Intro
- Snippet Forking Tutorial
- Pull Request Snippets
- Library Manager Area
- Excel-based Translation
- Dynamic Router Details
- Database Auto Updates
- Subform Quick Demo
- VDM Package Import
- Dynamic File Inclusion
- File Field Upload
- Drag-n-Drop Upload
- Quick HelloWorld JCB
- Non-database Fields
- Dashboard Customization
- Menu Prefix Toggle
- Community JCB Packages
- Collaborative JCB Workflow
- JCB Package Install
- JCB JAB18 Event
- Convenient New Fields
- Component Language Strings
- Library Functionality Anticipation
- Join Field Relations
- License Template Change
- Code Reusability
- Local Dev Environment
- Extended Field Types
- Joomla Custom Fields
- Custom Field Expansion
- Site View Listing
- Run Expansion Method
- Form Site View
- Field URL Update
- Additional Helper Methods
- Field Validation Rules
- New Placeholder Feature
- Component Config Params
- Per-field Default Values