diff --git a/008-Advanced-Fields.md b/008-Advanced-Fields.md index 03131a1..02a3edb 100644 --- a/008-Advanced-Fields.md +++ b/008-Advanced-Fields.md @@ -26,18 +26,11 @@ To explain to you exactly what the system is doing, I can go to components, open Anywhere in all the custom coding that you're adding and you need to use the components name, [00:12:16](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m16s) you can simply use this ### tag format of replacement. In some areas you would need to use brackets like that [[[. But most of the time it will work either way. The best measure to ensure is to try it with a # first and if you go into the code and you see it didn't replace it, then you know it's the angle brackets[[[ that needs to be used anyway. In this case we are using these ### sign characters. The view again, that is this single variable of the view. If we were to close, and go to the view(admin) which would be then preacher, all lowercase, is what you would be adding here. Make sure that it's always lowercase. [00:13:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m20s) -Then the list view or the views plural, would be the add value there. All lowercase as well and then the value field is the field that the user will see. That is what is visible in the UI user interface. The key field is the value that will be stored in the database. This field relate to this table(#-###component###-preacher). Inside this table, what field do you want the user to see? That would be the name of the preacher. And inside this table, what field would you want to store in the other database? Because we are looking into preacher but we are going to store it wherever this field is being used. That would be the ID and the column name in that data base of that view where this field will be used, will be called [00:14:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) preacher. To show that to you in the database itself. You can open it there,(See video) scroll down to sermon distributor, open sermons, click on structure, and here in the back end. Go to sermons, click 'new' and you will see that there is a place for preacher. If I was to look with firebug at it, we'll see that it is the name is preacher and remember we spoke about this Jform_ as the ID. But it's actually simply the preacher field which is being stored directly in the database in the preacher [00:15:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) column of the table. It's stored as int 11 and that was set up here. Int 11 and we say that it is a key. We can target it. At the bottom if we look at indexes, we'll see that it has actually added it as a key. - - - - - - - +Then the list view or the views plural, would be the add value there. All lowercase as well and then the value field is the field that the user will see. That is what is visible in the UI user interface. The key field is the value that will be stored in the database. This field relate to this table(#-###component###-preacher). Inside this table, what field do you want the user to see? That would be the name of the preacher. And inside this table, what field would you want to store in the other database? Because we are looking into preacher but we are going to store it wherever this field is being used. That would be the ID and the column name in that data base of that view where this field will be used, will be called [00:14:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) preacher. To show that to you in the database itself. You can open it there,(See video) scroll down to sermon distributor, open sermons, click on structure, and here in the back end. Go to sermons, click 'new' and you will see that there is a place for preacher. If I was to look with firebug at it, we'll see that it is the name is preacher and remember we spoke about this Jform_ as the ID. But it's actually simply the preacher field which is being stored directly in the database in the preacher [00:15:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) column of the table. It's stored as INT 11 and we say that it is a key. We can target it. At the bottom if we look at indexes, we'll see that it has actually added it as a key. **Custom PHP layout in Field Definition** -That all is done right here in the database structure and then in this area here. Again in this part which you can add your own custom PHP. The fact that I'm using 19, 18, 17, it's just creating line breaks and spacing and tabs for me dynamically. I could have placed them all under PHP one, without this quotation marks. [00:16:32](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m32s) Wrapping around them all like we just did with the file folder list view example we did previously. Just a note inside of this code, you cannot use quotation marks, you need to use single quotes. Unfortunately at this stage it is not able to accommodate you even if you try to do an escape. It will not behave as you might expect. So my apologies for that. At this stage you can only do single quotes between these two quotations, double quotes. +That all is done in the database structure and then in this area here(See video). Again in this part you can add your own custom PHP. The fact that I'm using 19, 18, 17, it's just creating line breaks and spacing and tabs for me dynamically. I could have placed them all under PHP one, without this quotation marks. [00:16:32](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m32s) Wrapping around them all like we just did with the file folder list view example we did previously. Just a note inside of this code, you cannot use quotation marks, you need to use single quotes. Unfortunately at this stage it is not able to accommodate you even if you try to do an escape. It will not behave as you might expect. So my apologies for that. At this stage you can only do single quotes between these two quotations, double quotes. That is adding a custom field which is a little bit more advanced. If you know PHP you will know exactly what's happening here. **Build Code for Sermon Preacher** @@ -48,25 +41,29 @@ These place holders reflect back to these 'key_field_id' values here. So basical Now we just trying to get across how to build a component. [00:19:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m40s) Not to extend component builder itself as yet. At least here you can see where in the code it is building this and compiling this and putting it together. Remember we talked about getting the structure, let's [00:19:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m59s) go down. This(see video) is used for the button. This is to generate a new button. When you click on new, that(selected area) is the button. This area from there to there is generating the button. This is what controls whether the button should show up or whether it shouldn't. [00:20:21](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m21s) Even if it is to be set at all this is what generates the button. This area here, the 'get options', you will see, we said that it will show the name, and it will show 'ID'. Go back to our structure here, we dynamically replaces these(###ID###,###name###) with those 'view preachers'. The reason for it , is that it's actually done a few times. [00:20:48](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m48s) I felt like let's make it that you only need to update these values and then it gets updated all over in the bottom of the code. It makes it just much more easy to change your custom fields. It build a field called preacher name. Which again it uses here 'preacher_name' as a object value. Because it [00:21:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m17s) retrieves the object from the database and it looks as if that object exists, it actually reiterates and builds up option list which is returned to use in the drop down. It dynamically generates your list. So component builder through that infrastructure what I have [00:21:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m37s) Just explained here, compiles all of that code for you and puts it in the right file in the right place. - Once you build a component and you know where you have made those changes in component builder, you can go look at those files if you know how to build a Joomla website. I used the same conventions as decor in regards to implementation of the files. [00:22:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m07s)