From 7ab9578c76c7e3a2a966de6f961f9a01b244c185 Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Fri, 7 Jun 2019 15:26:58 +0200 Subject: [PATCH] Updated 020 Adding Custom Admin Views to a Component (markdown) --- 020-Adding-Custom-Admin-Views-to-a-Component.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/020-Adding-Custom-Admin-Views-to-a-Component.md b/020-Adding-Custom-Admin-Views-to-a-Component.md index bb775db..5f0070a 100644 --- a/020-Adding-Custom-Admin-Views-to-a-Component.md +++ b/020-Adding-Custom-Admin-Views-to-a-Component.md @@ -32,9 +32,6 @@ If I close this for a moment, then open that component. I will show you what hap And so these selections before, is only really necessary when you select main menu and submenu. Because then you want to say before what item you want this menu to be created. We selected dashboard list of records. [00:03:55](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m55s) And because of that it places that in combined results. And you need to select the records that you want to look at and then you can click on the combined results. They'll grab those ids and since we are modelling, data in the controller and the model, it gives back to the view these results through the custom implementation we've done. Just a quick refresher. [00:04:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m25s) -### How Buttons are Implemented +### How Buttons are Implemented - Important -If we go to component builder, and custom admin views, we open company results. We see that in the custom buttons, we added the php. We also added the button. We explain to component builder what kind of buttons we want. We set we are targeting a single item, you see editCompany gotoCompany, those buttons [00:04:55](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m55s) are actually related to going inside of the view. Then if you come out of this(Editing the Custom Admin Views), we see that even in combined results, we also added buttons. - -??? -But again those buttons Vcard companies gotocompanies corresponds to this controller. And if we go to the view itself, [00:05:27](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m27s) And we'll see that that's not responding to this button but actually To the buttons inside called companies and edit Those that's the buttons you were building in the custom View Where is the buttons we are looking at in here Is related to opening the custom view itself So That is just a quick Refresher Same goes with the combined results The combined results is the button that you are setting up here [00:06:02](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s) Where is the other buttons are once you have combined them And you've click combined results You see that it adds two buttons dashboard and companies and those two buttons was set up in the view it Self So that you can know and sort of Understand what Area controls what set of buttons This area controls the buttons before opening the view where is in the view the buttons your setting up there is for when you have opened the view Ok so that is setting up a custom admin View [00:06:38](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m38s) To your component And some of the switches obviously again If anything is unclear or you not exactly sure You can obviously come on and do anything So simply go change it to what you would think should work and compile a component and go look in the code And see what has been done and look and the Joomla if the face See what is being displayed And play around with it until you get that what you expected [00:07:10](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m10s) Just a quick heads up this ordering before is only compulsory when Actually selecting add to main menu or add sub menu And if you use those It means That If If you go to your component You have the icons area and here in the top you have your your Your [00:07:34](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m34s) Main menu items And once you've opened A Then you're here on the right you have sub menu So this is main menu this is dash list Now dash list is that one which goes to the top Of the Of the components Toolbar and then submenu is the one here on the side [00:07:58](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m58s) So if if this Custom admin view is simply needs to be placed in the submenu and its lives on its own it's not related to any other Dataset Then you can use the submenu method if you only wanna Featured in the main menu these are all the features that you could set Where is the dashboard List record Feature Helps you to sort of Link it to a specific set [00:08:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) Of Data data structures like Like this one does So you can select these ids and when when you click On this combined results the ids of the selected items gets passed to the controller And if I go back to that quickly Show you that how we use it Combined results Custom button [00:08:54](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m54s) You basically see that Go to companies Is not in here So we see we're using the main get called companies data get list query So let's go look at that data query I think that's we will find The use of the implementation of those ids So we see we are basically reaching into the Input array Array sorry object here We getting CID [00:09:35](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) Selected ids And we saying It can be SMD And Then we are exploding it and We are making sure it is intervals And we placing it in ids And so this actually gets the value From the post Object [00:09:59](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m59s) And Places that into ids and here we do some validation To ensure that the person who's trying to access the data has actualy the right To do it And once we past that We basically use those ids to to get The data so in in the filter [00:10:20](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s) We use ids And check whether All the IDs Are in a ID and that in the code Basically if you look at the code It's on the models combine results We see that it uses our checking method here Later down here It checks the IDs [00:10:45](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) Puts it array check if it's in array then implodes it And checks whether it is You know only gets those IDs That's how we we filtered the dataset With the results of the selection And So That's just a little bit looking into the backend On how to make use of those [00:11:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m07s) Features and again as you can see it's some custom scripting we added to the dynamic get method To take those ids and to use them In the way we intend now you you can ignore them But here is the way that I implemented it If you wanna drop that down pause the video And copy some of this area here Think would be the only part that will be Useful to your purpose And then you can use the IDs in your code [00:11:39](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m39s) As you please And know that this PHP as you saw In the code It runs before the get methods So it basically is a filtering option as you see there So then this query starts Then that code be wrote Is entered in here and then the rest of the code which is build by component Builder Is being done and you can use a filter option with whatever you [00:12:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) Collected up here Ok so that's Looking into adding custom admin views to component Builder And just showing you again the tremendous Leverage and Design choices you can make In ensuring that your component is dynamic And Get sort of breaks out of the mould So that you can achieve [00:12:32](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m32s) Nice Complex components Write inside component Builder Thank you for watching +If we go to component builder, and custom admin views, we open company results. We see that in the custom buttons, we added the php. We also added the button. We explain to component builder what kind of buttons we want. We set we are targeting a single item, you see editCompany gotoCompany, those buttons [00:04:55](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m55s) are actually related to going inside of the view. Then if you come out of this(Editing the Custom Admin Views), we see that even in combined results, we also added buttons. But again those buttons Vcard companies gotocompanies corresponds to this controller. And if we go to the view itself, [00:05:27](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m27s) And we'll see that that's not responding to this button but actually To the buttons inside called companies and edit Those that's the buttons you were building in the custom View Where is the buttons we are looking at in here Is related to opening the custom view itself So That is just a quick Refresher Same goes with the combined results The combined results is the button that you are setting up here [00:06:02](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s) Where is the other buttons are once you have combined them And you've click combined results You see that it adds two buttons dashboard and companies and those two buttons was set up in the view it Self So that you can know and sort of Understand what Area controls what set of buttons This area controls the buttons before opening the view where is in the view the buttons your setting up there is for when you have opened the view Ok so that is setting up a custom admin View [00:06:38](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m38s) To your component And some of the switches obviously again If anything is unclear or you not exactly sure You can obviously come on and do anything So simply go change it to what you would think should work and compile a component and go look in the code And see what has been done and look and the Joomla if the face See what is being displayed And play around with it until you get that what you expected [00:07:10](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m10s) Just a quick heads up this ordering before is only compulsory when Actually selecting add to main menu or add sub menu And if you use those It means That If If you go to your component You have the icons area and here in the top you have your your Your [00:07:34](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m34s) Main menu items And once you've opened A Then you're here on the right you have sub menu So this is main menu this is dash list Now dash list is that one which goes to the top Of the Of the components Toolbar and then submenu is the one here on the side [00:07:58](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m58s) So if if this Custom admin view is simply needs to be placed in the submenu and its lives on its own it's not related to any other Dataset Then you can use the submenu method if you only wanna Featured in the main menu these are all the features that you could set Where is the dashboard List record Feature Helps you to sort of Link it to a specific set [00:08:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) Of Data data structures like Like this one does So you can select these ids and when when you click On this combined results the ids of the selected items gets passed to the controller And if I go back to that quickly Show you that how we use it Combined results Custom button [00:08:54](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m54s) You basically see that Go to companies Is not in here So we see we're using the main get called companies data get list query So let's go look at that data query I think that's we will find The use of the implementation of those ids So we see we are basically reaching into the Input array Array sorry object here We getting CID [00:09:35](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) Selected ids And we saying It can be SMD And Then we are exploding it and We are making sure it is intervals And we placing it in ids And so this actually gets the value From the post Object [00:09:59](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m59s) And Places that into ids and here we do some validation To ensure that the person who's trying to access the data has actualy the right To do it And once we past that We basically use those ids to to get The data so in in the filter [00:10:20](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s) We use ids And check whether All the IDs Are in a ID and that in the code Basically if you look at the code It's on the models combine results We see that it uses our checking method here Later down here It checks the IDs [00:10:45](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) Puts it array check if it's in array then implodes it And checks whether it is You know only gets those IDs That's how we we filtered the dataset With the results of the selection And So That's just a little bit looking into the backend On how to make use of those [00:11:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m07s) Features and again as you can see it's some custom scripting we added to the dynamic get method To take those ids and to use them In the way we intend now you you can ignore them But here is the way that I implemented it If you wanna drop that down pause the video And copy some of this area here Think would be the only part that will be Useful to your purpose And then you can use the IDs in your code [00:11:39](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m39s) As you please And know that this PHP as you saw In the code It runs before the get methods So it basically is a filtering option as you see there So then this query starts Then that code be wrote Is entered in here and then the rest of the code which is build by component Builder Is being done and you can use a filter option with whatever you [00:12:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) Collected up here Ok so that's Looking into adding custom admin views to component Builder And just showing you again the tremendous Leverage and Design choices you can make In ensuring that your component is dynamic And Get sort of breaks out of the mould So that you can achieve [00:12:32](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m32s) Nice Complex components Write inside component Builder Thank you for watching