Updated 008 Advanced Fields (markdown)

Amigo 2019-06-03 07:42:55 +02:00
parent f8b29b430b
commit 5d338b647c

@ -14,10 +14,6 @@ Now there is a field type called 'file list'. The reason why I didn't use file l
How to create a sermon preacher custom field. Basically it's a preacher custom field. It is going to show a list of preachers. But is going to display the preachers that are set up in the preacher list view. So let's open that 'Sermon Preacher'. The convention [00:05:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m52s) is that you should call the type: preachers, that is the list view name. But you have to call the name you should use the same as the editing name which is preacher without the 's'. If you go back to your admin views you would use this name as the name of the field, but you have to use that name as the type. Because now you are creating a custom type, and the logic behind it, it is going to show a list of preachers but you have to select just one preacher. You can use any label you like, whatever is descriptive enough for your user to understand. There is a place for adding a description. Then in 'XLM field definition' we set multiple to false.They should only be able to select one preacher at a time. At 'Default 0' are all basically left to their default values and [00:06:56](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m56s) 'extending list', is the most common custom field that we have. If you want to receive a list of custom fields that is available, you can go up here to 'extend' and see that list, radio and check boxes are available. I think I should update that to also say users. User is also a user option to extend users. If you want to see what is available then look at that name 'Jformfield' and go to component builder. Go to the back end of component builder, that would be: 'administrator', 'components', 'component builder'. Then go to compiler, that's a folder, then go to Joomla 3, which is the current version we are targeting.
**Jform in Component Builder**
Then search for that Jform. [00:08:00](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s) The ones that are available to extend is 'user', 'Jform field', JForm field user, Jform field radio, Jform field list, Jform field checkboxes. This also means if there is a form field you want to extend that doesn't exist already in our advanced seminar, we will show you how to add your own form fields here. There is basically two places you will need to change. I wish I could tell you now one of them would be to add the field and update it accordingly. And the other one would be to add it in a few places in the code. And also in a Json file called settings there. Those are some of the things we will deal with in advanced adaptation of component builder [00:09:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m04s) We will still set up that series very soon it's not finished yet though.
@ -31,7 +27,7 @@ Then search for that Jform. [00:08:00](https://www.youtube.com/watch?v=VpzYbifqv
**Extending List in Custom Field**
Getting back to extending a list field, you simply add there list. Then there's also a few conventions. One of them being that if you are going to be targeting, like this example, we are targeting the preachers. You will be using the preacher table as the table that is being targeted. The question to ask is: Where is the data going to be found? That is the table that needs to be added. In which component is it going to be found? That is what's need to be added by component. Now the reason why we have this ### component### here, because it's a placeholder which component builder will replace with the components code name [00:10:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m08s) once it's built. It's a feature we added because some times we want to rename components. If you had statically added the actual component name there, and in every field go and update that name, and in every view go and update that name. Every where you actually statically added the components name, you will need to update it.
Getting back to extending a list field, you simply add list. Then there's also a few conventions. One of them being that if you are going to be targeting, like this example, we are targeting the preachers. You will be using the preacher table as the table that is being targeted. The question to ask is: Where is the data going to be found? That is the table that needs to be added. In which component is it going to be found? That is what's need to be added by component. Now the reason why we have this 'component' here, because it's a placeholder which component builder will replace with the components code name [00:10:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m08s) once it's built. It's a feature we added because some times we want to rename components. If you had statically added the actual component name there, and in every field go and update that name, and in every view go and update that name. Every where you actually statically added the components name, you will need to update it.
To explain to you exactly what the system is doing, I can go to components, open sermon distributor. Take the 'Name in code', like that(sermondistributor), copy, and see that it's lowercase c ,if it was a uppercase like that(C), it mean it would mean that you have to place the component [00:11:12](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m12s) name as well with an uppercase. So we would just do a lowercase s. That is actually what the system is doing. It actually is just replacing these place holders with the actual component name on the fly. Using the placeholders saves you time in the long run. From making changes everywhere, if you make a change to components name. Which is quite normal to do very often you start with the component and you think of calling it something and later realized that name is actually been used in the Joomla repository, and you need to choose another name. And to do that is going to affect the whole component and so we added this placeholder structure which should make the data less painful at least.