-
-
Notifications
You must be signed in to change notification settings - Fork 178
020 Adding Custom Admin Views to a Component
- Example Component Not Sermon Distributor
Now we'll look at adding custom admin view to a component. We'll make use of cost-benefit projection as our component.
And then we go to settings. And then we'll go to custom admin views. 00:00:20 We will see there is two custom admin views added.
It has more switches than the site view, because of its implementation being more dynamic. You can choose an icon, because in the back end you possibly want to have an icon when you are on the right 00:00:45 of the page. Then you can decide where this should show in the main menu. Select if you should show in the main menu.
The main menu is a menu that drops down out of Joomla's menu item list. Then the dashboard is that dashboard we go to every time when we start with a component where all the icons are showing up. Then the submenu is the one on the left, 00:01:14 which you will see when you are in a view. So these are all placements where you can possibly add this custom view.
Now if you remember, the company results we didn't add to any of the views individually. We add it to items. That's why all of these are set to no. 00:01:41 That means we are targeting an item in a view.
All we need to do a select the view which we are targeting, which is company. And we say, it has metadata yes or no, and it has access yes or no. That's basically 00:02:02 to ensure that it targets the correct view, is simply by selecting company here.
If I close this for a moment, then open that component. I will show you what happened with the settings. So here we have that component open. If I was to open companies, you will see that it has a button for company result. 00:02:27 Now if you remember when we set up custom admin view, we ensured that we are targeting an item id. By selecting company, we are saying we are targeting this companiess item id, and that is what makes it work. And then we set we want to see a chart. If we look at these this little charts what shows up in 00:02:55 the icon itself. We click on it. We see the custom view shows up and that icon shows up next to it, and all works well. We also see that there is a combined results button showing up in the toolbar. And that is because combined results which selected we want cogs to be the icon. We set 00:03:25 list of records to yes, and has metadata, and has access, and also company.
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 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
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 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 the controller. If we go to the view itself, 00:05:27 we'll see that, that's not responding to this(see video) button but actually to the buttons inside called companies and edit. Those are the buttons you were building in the custom view. Where as the buttons we are looking at in here(see video), is related to opening the custom view itself. That is just a quick refresher.
Same goes with the combined results. The combined results is the button that you are setting up here(custom admin view). 00:06:02 Where as for the other buttons are, once you have combined them, and you've click combined results, you will see that it adds two buttons, dashboard and companies. Those two buttons was set up in the view itself. You can know and understand what area controls what set of buttons. This area controls the buttons before opening the view. Where as in the view, the buttons your setting up there, is for when you have opened the view. That is setting up a custom admin view 00:06:38 to your component.
Some of the switches obviously again, if anything is unclear or you not exactly sure, you can come and undo 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 in the Joomla if the face, and see what is being displayed. Play around with it until you get that what you expected .00:07:10 Just a quick heads up this 'order before' is only compulsory when actually selecting add to main menu or add sub menu. If you use those it means that if you go to your component, you have the icons area, and here in the top you have your 00:07:34 main menu items. Once you've opened, then here on the right, you have submenu. This is main menu, this is dashboard list. Now dashboard list is that one which goes to the top of the components toolbar and then submenu is the one here on the side. 00:07:58
This custom admin view 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 want to featured in the main menu, these are all the features that you could set. Where as the dashboard list record feature helps you to link it to a specific set 00:08:25 of data structures like this one does. You can select these ids, and when you click on this combined results, the ids of the selected items gets passed to the controller. If I go back quickly to show you that how we use it. Combined results, custom buttons. 00:08:54 We're using the 'main get' called companies data (getlistquery). Let's go and look at that data query, I think that's where we will find the use or the implementation of those ids. We are basically reaching into the input object here. We getting cid, 00:09:35 selected ids, and we saying tt can be CMD. Then we are exploding it, and we are making sure it is intervals, and we placing it in ids. This actually gets 'this' value from the post object, 00:09:59 and places that into ids. Here we do some validation to ensure that the person who's trying to access the data has actualy the right to do it. Once we pass that, we basically use those ids to get the data.
In the filter 00:10:20 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 Puts it in an array. check if it's in an array then implodes it. Checks whether it gets those ids. That's how we filtered the dataset with the results of the selection. That's just a little bit looking into the back end on how to make use of those 00:11:07 features and 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. You can ignore them, but here is the way that I implemented it.
If you want to drop that down, pause the video, and copy some of this area here. I think it would be the only part that will be useful to your purpose. Then you can use the ids in your code 00:11:39 as you please. Know that this php as you saw in the code, it runs before the get methods. It basically is a filtering option as you see there(see video). 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. You can use a filter option with whatever you 00:12:07 collected up here. That's Looking into adding custom admin views to component builder. 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 mold so that you can achieve 00:12:32 nice complex components write inside component builder.
- 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