22 010 Component Settings
Amigo edited this page 2019-08-15 17:22:38 +02:00

COMPONENT SETTINGS

00:00:00 (Click on these time links to see Youtube video)

Now that we've added the admin views to the component, let's look at some of the features still available inside components. Adding your custom admin views is done there and the site views are done here. (See video.) There is 'custom admin menus'. Controlling the menu structures for these and custom admin views in the site views are done inside these. This is if you are adding custom back end views that haven't been developed inside of component builder.

Compiler Info

00:00:51

Component Builder itself has a compiler view. It's this view here. This entire view is done outside Component builder. It needs a model, a controller, a view, and everything in regards to it if you look at the infrastructure of Component Builder. 00:01:32 You would see there is a place called custom. Inside custom, everything that you want to include inside of your component is added into the custom folder. Anything that you want to integrate is in here. 00:02:02 You might find a bunch of things already there. I would encourage you not to remove them because depending on what you do in component builder it will automatically include these. (See video.) 00:02:32 All of these are in the custom tab. There are files as well. The component builder itself has its compiler view here. It is just empty folders. The actual files and the default compiler file is here; if I open it the script shows a dropdown of items. 00:02:59 I also have the controller, the model, the compiler, and the helper file. I am including it into my component.

Adding Custom Files - Folders

00:03:50

I'm including a bunch of things in files which means that I'm including the 'Compiler' and that I take this file and put it in 'admin views compiler' and rename it. (It has the wrong name in this instance.) If you add the right name at the end of the string it will rename that file that it is adding custom files as well as custom folders. 00:04:16 I'm grabbing the compiler views, dumping them into views, and renaming them to the compiler, compiler views becoming compiler inside of the views folder. The system will first build the folders then move your files to them. You will put the files here. (See video.) 00:04:44 Let the system do the folders and it will move the files.

Adding Custom Admin Views

00:04:54

This custom admin menu is what I use to the map the compiler menu. I want to call it compiler. (The code is compiler.) I'm not using a link, because it's not another extension or website. Now I would select an icon. Here is the information. (See video.) 00:05:17 It's the same kind of switches as there was adding a back end admin view. You can tweak whether it should be an admin menu, a dashboard, or a submenu. We are placing it before component, so we select 'select before what admin view this one should be placed'. This means that it can go to the top. 00:05:49

Custom files and folders that you have created by hand and are importing into your component when you compile it. The same is done with the compiler of Component Builder. I'm including it as files. 00:06:16 There is the compiler. (See video.) I took all the compiler files and placed them into the folder called compiler. It's a folder which moves all the files at once.

Here is a folder with a lot of content in it. (See video.) 00:06:48 I placed everything I wanted to move inside this folder; so, in my component, I can target that folder and it pulls it in. That shows how a whole lot of folders are added to component builder. When I need to add a back end admin view custom this feature here does that. (See video.) 00:07:18

Adding Custom Config Fields

00:07:27

The area called config deals with something quite useful. It is to set up your back end global fields. Go to sermon distributor, 'settings,' and 'config'. There is a long list of things. If we go to the actual component, you will see that it has many tabs. 00:08:25

Custom Switches Using Sermon Component

00:08:34

All of these switches are done in the config area, except some of the defaults which are added by the simple switches. For example, the global timer of which we spoke about the check-in. Here you can set it all; whether it should be every 5 hours, 12 hours, once a day, every second day, once a week, or never. It checks in your items automatically. The version control buttons are added automatically as well. That means the person can set the version control 'on' or 'off' and the number of records that should be set. 00:09:07 If 'zero', all versions will be saved.

Adding Contributors

00:09:21

The author areas are also added automatically. When you click on the 'component,' you will see a 'contributing area'. You can set whether you want to add 'empty contributor fields'. Here you can add as many contributors as you like; for instance, those involved with developing your component and the number of empty ones you want to leave there. It's also tweakable. That will add this area here. (See video.) 00:10:09 When you use this switch it controls whether it's will show in the back or the front, etc. They are added automatically, as is the permissional structure.

Adding UIkit

00:10:33

In the component, you can set it to include UIKit. It will automatically add this feature to your component and everywhere UIkit is used.

Adding Fields To Custom Config Fields

00:11:06

To add fields to the config area, you need to add the field to fields. Go to fields; whatever field you want to use you need to create here. (See video.) Now you need to remember the system name that you're using so that when you open up this you would be able to type in the name and it will be selected. By convention as long as you use the same tab name it will be bundled in the order of which you set it here. 00:11:40 It is in the Dropbox area where all their fields are being set. The reason why we include this demo component into the application with the tutorial is that you can see that he's using 'Dropbox update method' here. 00:12:00 You can go look at this file. If you click it, it starts an update. 00:12:23 It' There is some 'global' like, 'local folder', 'download link'.s not that simple to do that because we are not inside of our component, we are in the config component in the global if you have global settings. 00:12:56 You can look at these things in this list view. All the Dropbox information is there. (See video.)

Spacer HR Field In Component Fields

00:13:24

'Spacer HR.' You'd see 'spacer hr' quite often. It's a field that will be included in the paid version of Component Builder. It has 'spacer hr' in it since you can use the same spacer over and over. The system automatically increments it, so that it doesn't have conflict in name conventions. Putting spacers which is this little line. (See video.) 00:14:01 It's very small but gives a space between these areas. You can also place default values which will be used during the installation of the component. If you have switches in your config that you want to populate with default values, you should add those values here. 00:14:27 During the install, those values will be added to the database and component builder puts it in place for you. This is where you add the config fields. (See video.)

Tab - View Names Fields added to Site Menu

00:14:55

I added a convention that isn't that obvious. If you use a tab name, which is the same as a front end view, then it will add this field to that front end views menu. Joomla's Content Manager does the same thing. In the global setting of your article manager, you can set features for categories and articles, but if you create a new article in a menu item, you can use 'global' or overwrite them.

The feature of using the same tab name is 'preacher/ switch' whether it should be a table or a grid. 00:15:48 We set the default 2, and called it preachers plural. That is quite important. Let's look at the front. There is a bunch of menus. 00:16:09 Go to a menu that I've already created called 'preachers' then go to the components back end called 'preachers'. You see there is a list of items. I added the name 'preacher' as a tab name in the component builder.

Now the fields. There is a list of the fields. (See video.) 00:16:41 These fields I created in the field area with field types. In the view, if you click on sermon distributor, you will see those exact same fields. It has the option of using the global instead of overwriting it. 00:17:07 You can decide in this specific admin view if you want to use 'grid' and not the 'global' option.

The system of adding these extra features to every item view of the front end is integrated by a convention. I selected a menu item called preachers since the front end is called preachers. 00:17:47 I added the files and used the convention of the front end page, so there is the same for preacher which is single. 00:18:15 If 'sermon distributor' is selected, then select 'preacher', which is another view. If I click 'sermon distributor' all the switches will be mapped out. (See video.) They have some default values. 00:18:43 There are the fields. If I click on 'preacher' in the back end of the component, the same fields are found. You can set global settings and overwrite them in the menu by not using global. This feature is possible through this config tab. 00:19:08 Because of the name of the tab, the system knows this is related to any front end menus as well. Therefore it will automatically create the front end things for you. 00:19:47

Site View Explanation Of Above Tabs

00:19:57

At the front of this component, if the view 'Preachers' is opened you will see an extra file called 'Default XML' in the template. Open 'default XML'. Now Component Builder adds the convention to this file. 00:20:18 (If it's not working as you expected, this is the file in which you look to see what is wrong. In the specific view that you have, it must be this view and the tab name in the file called 'default XML.') (See video).

Quick Explanation Of Creating Site Views

00:20:45

Since we haven't dealt with adding site views I will quickly explain it here so that you at least know something that relates to this. If you didn't click on 'add' as a menu, set it to 'no,' and the file will not exist. It only exists if this is set to 'yes'. 00:21:11 Setting it to 'yes' tells Component Builder to build this default XML file, and setting the tabs to the same name as this view tells Component Builder to add those fields to this field. It will create it so that your user can have a unique implementation. This is important. 00:21:34 It doesn't make use of this information necessarily inside of your site view. You need to make use of this information in your site view.

Using Of Parameters

00:21:50

If you're a developer you would know that inside of your component, you have a place where you can check the params header. The parameters are set inside of the 'view.html.php'. Here we set the parameters. (See video). This gets all the parameters in relation to this view. It gets the component parameters and the menu parameters, and, if global had been used, automatically fall back on what is set here. 00:22:33 So you're using the same name, display, and display; if you are using global parameters gets this parameter. 00:23:02 The display field is getting that parameter. It looks at the 'menus settings,' set to global, and it automatically falls back to the global settings. This means that by using params and doing a check-up this value is inside of this param. 00:23:34 Go to the default view; 'preacher display'. That's the field name in the global configurations. (See video.) 00:24:03 If I were to go and open this field you'd see the list of the 'switch preachers' fields in the Fields tab. 00:24:37 Open that specific field and see that the name of this field is 'preachers_display'. 00:24:56 It is quite important that none of the fields have the same name. Every field in this global area must be unique.

If you are a developer, always keep the concepts of conventions logical, repetitive, and scalable. Here is one that I have added for instance. In the global area go to 'preachers'. It is this field here, 'Display - Table - Grid - List' and in the code, if preacher_display = 1, then show the table. 00:25:59 If preacher_display = 2, then show the grid. If none is selected then show the list. 00:26:21 I'm not asking does the global have this or that, I'm just calling the field directly, because Joomla gets that initial data and sorts it out for you. I've tested it and made sure that my explanation is correct. The same goes when it comes to 'colors'. (See video.) 00:26:55 Component builder makes it easy to implement these kinds of things which otherwise would take time to write and then make sure it's the same inside of the XML folder menu, etc. Component Builder does all of this out of the config file with a convention that relates to the actual front end. 00:27:26

It might be better for us to stop here with the component and look at setting up a custom admin view or setting up a site view. 00:27:48 The ideal will be first to deal with some of these component features. As soon as we've finished it, go into the custom area of your front-end development and custom admin development and relate back to what we have discussed as we continue. 00:28:12

I've now looked at the setting tab and had tried to cover as much of this area as possible. I haven't mentioned much about the 'MySQL' tweak. This is an advanced feature. 00:28:44 You'll be able to exclude dummy data through this area so that if you have different versions this 'MySQL' tweak will be able to exclude certain information. It won't be used in many cases. It's only when you start having multiple versions of the same extension and you are marketing them at different prices that you want to be able, from within component builder, to export the different versions. 00:29:17 I think we can deal with it when we start looking at more advanced implementations.