From 5dca1b0ccb39a0ff2eb089f1d822ca68f5ab01cb Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Wed, 29 May 2019 15:35:43 +0200 Subject: [PATCH] Updated 010 Component Settings (markdown) --- 010-Component-Settings.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/010-Component-Settings.md b/010-Component-Settings.md index 564b49e..98667b4 100644 --- a/010-Component-Settings.md +++ b/010-Component-Settings.md @@ -55,4 +55,6 @@ This is important since we haven't dealt with adding site views. This site views **Using Of Parameters** -If you're a developer you would expect that right you would know inside of your component, you have [00:21:56](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m56s) a place where you check params header. Should it show, then it shows it and you are getting it from the parameters. The parameters are set inside of the view.html.php. You see here we set the parameters. We do this 'app- get params'. This actually gets all the parameters in relation to this view. It gets that component parameters, it gets the menu parameters, and it automatically if it has the custom, [00:22:33](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m33s) if they've used global, it will automatically fall back on what is set here. Which is excellent. So you're using the same name, display and display. It's the same name. And so if you are using global, what parameters does, its getting this place, parameter. [00:23:02](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) The display field is getting that parameter. It first looks at the menus settings and that one is set to global, it automatically falls back to the global settings. That is done by Joomla itself. It's not really something I build. It's just the way Joomla works, which is excellent. That means that by using params and then doing a check-up. This value is inside of 'this params'. [00:23:34](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m34s) And then I go to the default view and let's see where am I implementing some of that. Let's go to here the 'preacher display'. The field name wasn't just display I'm sorry it was called preachers display. That's the field name in the global configurations. [00:24:03](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m03s) If you're not with me it is what we used for this field - 'switch preacher tablegrid'. It's called preacher display. If I was to go and open this field you see the whole picture, 'switch preachers tablegrid'. Here is the list of the switch preachers [00:24:37](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m37s) fields. As you can see I'm in the fields tab. I'll open that specific field. And you'd see that the name of this field is preachers_display. [00:24:56](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m56s) You need to make sure that none of the fields have the same name. That is quite important. What I mean by none of the fields, I mean this(preacher) field must not be the same name as that(plain) field. Every field in this global area must be unique. It should never overlap. That is why I use the convention of preachers display so that I can also use preacher without the 's' display and I can use [00:25:25](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m25s) category_display in you see so that I have that site of convention of implementation. You should all around as you develop think about conventions using sort of logical repetitive scalable concepts. And so this is one of them that I've done. I just added it here. It's that specific item. And then in the global area you go to preachers. It is this field here(Display - Table - Grid - List). [00:25:59](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m59s) And in the code, if preacher_display = 1, then show the table. If preacher_display = 2, then show the grid. And if non is selected then show the list. Which is the three options if you look at the button. The button has table grid list. [00:26:21](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m21s) I'm not asking does the global have this or that, none of that, I'm just calling the field directly. Because the way that Joomla gets that initial data like I showed you here. They sort that out for you. That's quite nice. I've tested it and made sure that my explanation is the truth. So goes with the colors. You can see here I again I do 'this.>params.>get('preachers_tables_color') colors. But this is actually knowledge that you would have [00:26:55](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m55s) if you have developed a component for Joomla. You would know about these tricks. I'm just showing to you how component builder makes it easy to implement these kind of things. Which otherwise would take so much time to write this up and then make sure it's exactly the same inside of the XML folder menu and so forth. Component Builder does all of that out of this config file simply with a convention that relates to the actual front end. [00:27:26](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m26s) I think we have covered that thoroughly enough. That will be all for this tutorial. I will continue looking at more concepts of the component. And it's features. Possibly it might be ideal for us to [00:27:48](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m48s) stop here with the component and go look at setting up a custom admin view or setting up a site view. Yet I'm thinking you know if we go that route, It's going to take us on a very long road so the ideal with me. Let me sort of Dealt with some of this component features first and finish that. [00:28:12](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m12s) And then as soon as we've finished it, we'll jump into the custom very nice area of your front-end development and custom admin development. And then we will obviously be relating back to what we have discussed here as we go. So I've now looked at the setting tab and try to cover as much of this area as I can I didn't talk much about MySQL tweak. This is a very advanced feature and [00:28:44](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m44s) you can know that what it really does if we have dummy data. You're able to exclude them through this area so that if you have different versions you will through this MySQL tweak. Be able to exclude certain information which I realize it's a little bit advance and so for most cases people will just not use this. It's only when you start having multiple versions of the same extension and you selling them at different pricing and want to be able to [00:29:17](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m17s) from within component builder just export the different versions then you start using this feature and I think we possibly deal with it with when we start looking at more advanced implementations. We'll start in the next run with scripts +If you're a developer you would expect that right you would know inside of your component, you have [00:21:56](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m56s) a place where you check params header. Should it show, then it shows it and you are getting it from the parameters. The parameters are set inside of the view.html.php. You see here we set the parameters. We do this 'app- get params'. This actually gets all the parameters in relation to this view. It gets that component parameters, it gets the menu parameters, and it automatically if it has the custom, [00:22:33](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m33s) if they've used global, it will automatically fall back on what is set here. Which is excellent. So you're using the same name, display and display. It's the same name. And so if you are using global, what parameters does, its getting this place, parameter. [00:23:02](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) The display field is getting that parameter. It first looks at the menus settings and that one is set to global, it automatically falls back to the global settings. That is done by Joomla itself. It's not really something I build. It's just the way Joomla works, which is excellent. That means that by using params and then doing a check-up. This value is inside of 'this params'. [00:23:34](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m34s) And then I go to the default view and let's see where am I implementing some of that. Let's go to here the 'preacher display'. The field name wasn't just display I'm sorry it was called preachers display. That's the field name in the global configurations. [00:24:03](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m03s) If you're not with me it is what we used for this field - 'switch preacher tablegrid'. It's called preacher display. If I was to go and open this field you see the whole picture, 'switch preachers tablegrid'. Here is the list of the switch preachers [00:24:37](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m37s) fields. As you can see I'm in the fields tab. I'll open that specific field. And you'd see that the name of this field is preachers_display. [00:24:56](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m56s) You need to make sure that none of the fields have the same name. That is quite important. What I mean by none of the fields, I mean this(preacher) field must not be the same name as that(plain) field. Every field in this global area must be unique. It should never overlap. That is why I use the convention of preachers display so that I can also use preacher without the 's' display and I can use [00:25:25](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m25s) category_display in you see so that I have that site of convention of implementation. You should all around as you develop think about conventions using sort of logical repetitive scalable concepts. And so this is one of them that I've done. I just added it here. It's that specific item. And then in the global area you go to preachers. It is this field here(Display - Table - Grid - List). [00:25:59](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m59s) And in the code, if preacher_display = 1, then show the table. If preacher_display = 2, then show the grid. And if non is selected then show the list. Which is the three options if you look at the button. The button has table grid list. [00:26:21](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m21s) I'm not asking does the global have this or that, none of that, I'm just calling the field directly. Because the way that Joomla gets that initial data like I showed you here. They sort that out for you. That's quite nice. I've tested it and made sure that my explanation is the truth. So goes with the colors. You can see here I again I do 'this.>params.>get('preachers_tables_color') colors. But this is actually knowledge that you would have [00:26:55](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m55s) if you have developed a component for Joomla. You would know about these tricks. I'm just showing to you how component builder makes it easy to implement these kind of things. Which otherwise would take so much time to write this up and then make sure it's exactly the same inside of the XML folder menu and so forth. Component Builder does all of that out of this config file simply with a convention that relates to the actual front end. [00:27:26](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m26s) I think we have covered that thoroughly enough. That will be all for this tutorial. I will continue looking at more concepts of the component. And it's features. + +Possibly it might be ideal for us to [00:27:48](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m48s) stop here with the component and go look at setting up a custom admin view or setting up a site view. Yet I'm thinking you know if we go that route, It's going to take us on a very long road so the ideal with me. Let me sort of Dealt with some of this component features first and finish that. [00:28:12](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m12s) And then as soon as we've finished it, we'll jump into the custom very nice area of your front-end development and custom admin development. And then we will obviously be relating back to what we have discussed here as we go. So I've now looked at the setting tab and try to cover as much of this area as I can I didn't talk much about MySQL tweak. This is a very advanced feature and [00:28:44](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m44s) you can know that what it really does if we have dummy data. You're able to exclude them through this area so that if you have different versions you will through this MySQL tweak. Be able to exclude certain information which I realize it's a little bit advance and so for most cases people will just not use this. It's only when you start having multiple versions of the same extension and you selling them at different pricing and want to be able to [00:29:17](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m17s) from within component builder just export the different versions then you start using this feature and I think we possibly deal with it with when we start looking at more advanced implementations. We'll start in the next run with scripts