Updated paragraph titles to h3

Llewellyn van der Merwe 2019-06-07 15:20:13 +02:00
parent d4de59632f
commit 7cf14ca1b0
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
16 changed files with 171 additions and 171 deletions

@ -6,33 +6,33 @@ In this tutorial we will look at creating fields. There are two groups. Easy, pl
First we'll look at the more common field types. Not all of them, of course. I'm just going illustrate to you a text field type and a list field type. [00:00:54](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m54s) All the other sort of fields follow the same kind of implementation.
**New field type** _Using text field as example_
### New field type _Using text field as example_
So let's create a new field type. We would select text as our first illustration. It will automatically load the fields here set on the field types default settings we looked at previously. When it comes to this information here you need to have a good background on MySQL to understand what a varchar, a text, a medium text, a long text, and so on, exactly means. [00:01:29](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m29s) These are basically the data types in relation to the database. I have now added the feature of you being able to change that because I want to liberate your ability to develop applications that are more advanced than a cookie cutter kind of component builder. [00:02:04](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m04s) This component builder wants to leave enough room for you to make very advanced choices. So the more I constrain it to a sort of "just click here, there; don't know any code, just go on and build something," the more I am going to frustrate the real developer who wants to design something more advanced and versatile. [00:02:25](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m25s) There are component builders out there that probably have done that, but I want to give you enough tools to be creative which means a little bit more complexity all over. But if you know PHP and have worked with PHP in relation to SQL or any other SQL database connections via Java or any other language, you will know that there is such a thing as a data type.[00:02:59](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m59s)
**Indexes types**
### Indexes types
You will know that it has a length, that you can set some default value to it, and that you can decide whether it's a key or a unique key. Just realize that if you set it as a unique key (as an Index type) it means that specific field will only allow a value once and if that same value is placed in it, it will be an error. [00:03:38](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m38s) You hardly ever use that. You won't even use it for an alias because the alias implementation in Joomla deals with the duplication within the model when it saves the information. It actually checks whether there is an alias in the database and implements the alias so that it doesn't conflict. So even there you do not need that feature. But it is available and you might see a need to use it, so I added it there.
Then your normal null switch. (Whether the table should be null if it's empty.) [00:04:15](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m15s) Usually you would use one of these default values and then set it to "not null."
**Store method** _Default, JSON and other options_
### Store method _Default, JSON and other options_
Now the storing method. Most of the time you will use default. This is because these other methods require much more knowledge of what you are trying to achieve. If you do have that knowledge, then I would say that JSON would probably be used when you are storing an array of items to the database. [00:04:42](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m42s) Yet when you are using list (which we'll look at just now,) you wouldn't need to use JSON because Joomla's implementation of the list field type deals with arrays. [00:05:09](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m09s) If the list allows for multiple selection then you need to use JSON. [00:05:37](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m37s) If the field type is check boxes it will be going here and it will add it. If there are multiple selected, it will add it as a JSON option object if the type name is tag. [00:05:56](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m56s) So if you are using a tag field type it will not go in here no matter what you do. If it's not zero, which is default, then it will fall back onto this. If it is check box and you haven't selected one of those features.... [00:06:22](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m22s) For example, if you haven't selected one of these JSON or base 64 and it is a checkbox field type, then it will fall back to JSON. [00:06:47](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m47s) That's the default switch. In the switch it takes what you've set. If you set it to JSON, it will use JSON; if you set it to base, it will use base; if you had done an encryption, it will use that; but if you had set none and it is a checkbox, it will set it to JSON even if you had set the checkbox to default. [00:07:12](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m12s) We are still making sure it's safe as JSON because Joomla doesn't deal with check boxes correctly. In fact it tells you as a warning on their pages. The Component Builder knows that and so I coded it, so that it will make sure that we're storing it as a JSON Object and not just the array itself.
**Compiled info in UI** _Explanation of compiled fields_
### Compiled info in UI _Explanation of compiled fields_
This is just looking at the check boxes and other JSON items for the view and so for most things that we are looking at the UI. [00:07:47](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m47s) If we are not sure how the implementation works, looking at the code is the quickest way to actually understand what would be the way to select. That means if you're not a PHP developer and you cannot figure out where this line or this particular area of code is being addressed, then obviously this is to your own disadvantage. But if you're able to read PHP then the compiler itself leaves in the XML files and other files that you are building. [00:08:20](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m20s) In other models of things that it's building it is showing you in which file it is actually building this part of this group and exactly on what line. So that is the way for you to get in there and see exactly what is being done. [00:08:52](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m52s) It will also help you to determine what you need to change for it to work if it isn't working. There is no way for me to avoid this.
**Store methods support encryption** _Encryption of fields supported_
### Store methods support encryption _Encryption of fields supported_
Going back to just a normal text field. We would just leave it to default. These other options of encryption will be explained in a later video. [00:09:22](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m22s) You would possibly never use these. I had the need for them in a component that I had to develop, and so I added those features in. At this stage it's really quite difficult to implement. The basic one, which is actually more secure if you would ask certain people, is easy to implement. [00:09:50](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m50s) But the advanced one, which is for other purposes than just your normal encryption, is a bit more advanced and difficult to implement. So for now, if you're not that advanced in your programming skills then you should just avoid these. This base64 is often used where you're storing code into the database. Most of component builder's areas where you can add custom scripting uses this base64 as the storing method.[00:10:22](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m22s)
**Example e-mail field** _E-mail field and XML fields example_
### Example e-mail field _E-mail field and XML fields example_
So if we are going to create an email field, we say that it should not be required, change data length\values to 255, leave store method to default, and change name to email. (We don't usually do uppercase.) [00:10:47](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m47s) That's what is going to be used for the database. So this field all over the system and all the code is going be called by that name: email. Underscore. [00:11:09](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m09s) Here the label is what will be visually seen in the form. There we'll be adding 'Enter Email.' We'll leave the text size the same. Max length is good. I'm not going to use the default field. [00:11:36](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m36s) Default is optional so I can just leave it out. Description: I'm going to say 'Enter Email.' We'll remove those (readonly"false"; disabled"false".) We're going to leave required to 'false' to ensure that it isn't required. Then I'm going to use validate email and I'm not going to use the field option. [00:12:08](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m08s) The field option is to validate against another field that they both 'equal' each other. We don't need that for this field. Here I'm going to place demo. I'm going leave those (showon; onchange) out. So there we have an email field. Now this validate option. (There is some custom validating option in Joomla. Email is one of them.) [00:12:42](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m42s) Then there is a way to create your own validation. The way to implement that would be to write PHP up for that. You need to know how to write your own validation and to place it via the custom adding in our files; to place it in the correct location where the Joomla form builder will be able to get that field validation type and add it into your field. [00:13:07](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m07s) So if you know what I'm talking about then you will know where to place it, and you'll later see that in the component itself it has an option to add custom files and how to map it to the correct location. [00:13:31](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m31s) You can then use your own validation figure type there to extend on the validation options. But currently component builder itself doesn't do extra custom validating options. It only uses Joomla's defaults. That means you can also leave it out and then it doesn't do validation but it will still do filtering. Here is a list of the available filters that Joomla has. [00:14:08](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m08s)
**Target fields with custom CSS/Javascript** _Adding custom CSS/javascript to fields, in both edit and list views using Jform and Jquery_
### Target fields with custom CSS/Javascript _Adding custom CSS/javascript to fields, in both edit and list views using Jform and Jquery_
So that's how to create a text field. You can target these text fields with CSS and JavaScript, respectively, in the list and in the single view. The views (plural) is the list view; view (single) is the single view that will be the edit view in the backend. Both of these are targeting the editing view and the list view in relation to its backend display. [00:14:36](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m36s) If you extend the editing view to the front, then it will also load the JavaScript to the front. But you cannot extend the list view to the front. You need to build a custom front which we will eventually get to which is called site views.
@ -40,47 +40,47 @@ So this is primarily targeting your admin area with these scripts. Although you
The nice thing about this is that you can add the script to the field and in any view where you use this field this script will follow it. [00:16:54](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m54s) It will go along with it. It will be added to that view dynamically. You don't need to rewrite it everywhere. For example, I have a script that I'm using for numbers. [00:17:16](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m16s) Here is an even better option to demonstrate: I had to create a repeatable field, which we will look at later; it's an advanced field. Inside of that repeatable field I wanted to add a date field. [00:17:49](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m49s)
**Repeatable field with date** _Adding PHP and Javascript in custom script_
### Repeatable field with date _Adding PHP and Javascript in custom script_
Now those of you that work with Joomla will know that you can't currently add a date field to a repeatable field. So what we did (this is probably going to be very impressing) we simply used a text field and added that to it. [00:18:12](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m12s) As you can see here we have PHP right in this JavaScript block. The way to add PHP here is to do the open brackets, question mark, PHP, and then again question mark, close. There is an a PHP and we are adding the jQuery framework. Now this script I added to the repeated fields script area not to the actual text field. [00:18:45](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m45s) The reason why I didn't add it to the actual text field is because the text field is going be repeated. So you are going to have ten, twenty, or whatever of that specific text field. But with this code I'm able to target up to fifty repeats of that field. [00:19:11](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m11s) With that field number we set at least fifty, and this JavaScript area is being repeated fifty times. So the course_date_fields_date is an ID I got from after creating the repeated field. I went in and looked at the ID of that field, added a datepicker, set the value of the datepicker, and basically added it to the field. [00:19:43](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m43s) It works very well. So this custom scripting area for JavaScript can also take PHP inside of it (and JavaScript) that will then be added to the view in which this field is going to be used. However, since we are just using it for creating a simple email field, we will click save; or save and close or save and new. [00:20:17](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m17s)
**List field and adding options, static** _Setting up a static list_
### List field and adding options, static _Setting up a static list_
So that was looking at creating a text field type. Now we'll do a list field. We click on list and we see that it has an option 'array' or 'string' there. The options are set with a zero, a pipe, the name, and a coma. [00:20:45](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m45s) That basically represents one item in the drop down. So if you see this drop down here then each of those items would basically be represented between the comas. [00:21:05](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m05s) The (...) makes a separation between the value being stored in the database and the value being shown to the person accessing the form. If that value is the same value (if you want to store in the database the same value as the one that is being displayed) then you simply drop off the pipe with the initial values like that. It will now say option one, option two and option three. [00:21:29](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m29s) That is one permitted way to use it. [00:21:50](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m50s) You could also say that you want one option to be viewed as having not selected anything yet. So if you want to add another option you would type "select an option,." [00:22:15](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m15s) By adding a pipe without a value it is being treated as a null. So when the drop down is built, it will be as if nothing is selected. [00:22:57](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m57s) Now the other values would be selecting. You can use them as IDs or use a totally different value. It doesn't matter. Just know that it would possibly make everything lowercase if you put it on that side of the (...). [00:23:29](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m29s) You can fill in this information based on your requirements. So that's how you set up a list field.
I hope this shows you what is possible, but as you can see this list field isn't dynamic in the way that a custom field possibly can be. [00:23:55](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m55s) You see the list field here where you statically set a few values that is unchanging and which should be selected. But with the custom field type you can have other tables values populate the list for you. So as it's being created your list gets longer dynamically. We will still look at that and it is obviously available, but this is more static "set it once and use it over and over" whereas there is actually also a dynamic list option which I will illustrate later. [00:24:39](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m39s)
**Radio button example**
### Radio button example
Let's look at a radio button which is very similar to creating a radio button. There is one point to make here however. If you create a radio button you'd see that there are only two values. You can add more than two to the list, but I always think of it this way: [00:25:04](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m04s) as soon as it becomes a list of values then use a list. A radio button should have four selections at most. (It depends on the length of the text.) As soon as it gets a fifth value, you should look at a list instead. Again, with a radio button you can just leave it at the default storing method. [00:25:41](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m41s) Again the field attributes are very similar to the text attributes except for the 'options array' option here. Then also like the list field type, it is separated by a comma, and the store value and the display value are separated by a pipe. It is important to note that you cannot use quotation marks inside of your values. [00:26:06](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m06s) If you want to use quotations inside you need to look up the HTML equivalent of those quotation marks and use that. Then it would work, but if you add an quotation inside, it will break off the string and you would have only one value show up. [00:26:38](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m38s)
**Color field example**
### Color field example
Let's look at another one. Color is quite straight forward. It has a default value. You need to remember to set the label and the name. The type must not be changed. If you select color here and you do change the type, the component builder will simply ignore what you did. [00:27:16](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m16s) The reason for this is because we had set the type itself to be mandatory and unchanging when we had set up the field type. That's why you cannot override it. Everything that you set to mandatory and unchanging will fall back to the setting that you set there in the field type. Even if you change it here, it will not change. [00:27:44](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m44s)
**Showon attributes example**
### Showon attributes example
Then there is the description, and if it's required, the showon feature. You can have a list field which has an ID too which should be selected so that this color field should show. So you could say that this field's name is 'view' and 1. [00:28:17](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m17s) Only if the option with the value of 1 is selected in the view field will this field show up. [00:28:39](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m39s) You can have it if 1 or 4 is selected then it will show up. This implementation is your Joomla default implementation of the showon field. Unfortunately it cannot target multiple other fields yet, and that's why we have our own implementation in component builder which is far more advanced. [00:29:07](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m07s)
**Category field example**
### Category field example
Another one that's quite interesting is category. In category you have extension. If you read it, this extension is the name of the extension for which the category will be retrieved. For example, to list content categories use the value "com_content." [00:29:42](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m42s) You can add also target one view, use the value 'com_component.view.' That means that by adding the category field to a view you automatically add a category to your component so you don't need to map the category. In fact, you cannot map it even if you wanted to. [00:30:09](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m09s) Joomla already has a category component in place. (You can add your own category view and then use a custom field to link its values to other views.) If you are going to use Joomla's category implementation that integrates with your component, this is the way you do it. You don't write anything for the category area because Joomla do that itself and adds it to your component dynamically. The only thing you need to do is an extension, add your component's name. [00:30:48](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m48s) The categories can also be targeting a specific view instead of the whole component itself. So it can be related to just one specific view which means that you can have multiple categories for one component. [00:31:25](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) This might be an overkill, but it's none the less possible. The way you do that is simply, your component name, and the specific view's name. (The view must be singular. You cannot target a list view; it must be a editable, single view.)
**Editor field example**
### Editor field example
Editor is also a common field which is often used. [00:32:11](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m11s) The editor is that big block in your Joomla content article manager in which your articles are placed. Here you can add such a block to your component. There are some important things, like the buttons. If you read the description we have here it explains to you how it works, including the hide option and what kind of editor you want to load; the preferable or alternative one. [00:32:44](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m44s) The button option here: you can read it or hide buttons, based on what you selected. You have a filter option that require your normal attributes as with with other field types in Joomla. Since most of them are extending your base field in Joomla, the type, name, label, and default are also available to all the others. [00:33:24](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m24s)
**Media field example**
### Media field example
Media. Make sure with media that you select the correct directory. If none is set it falls back to images, but you can target a specific directory inside of images. It's mandatory, so you need to set it. You can only target images itself, which is a limitation from Joomla's side. So the directory starts at images. The attribute should be relative to the top level /images/folder. [00:34:01](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m01s) That means that if you want to target a specific folder inside images called 'foo,' then you would add that there. Then preview: if an image has been selected and you want the image to be able to be previewed by hovering over the side of the field, you change it to true. The 'showon' feature is here as well as the other default concepts that we had discussed.
**Notes field example**
### Notes field example
Notes come above a field. [00:34:43](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m43s) You can add notes around your fields. It has very nice implementation in the Field Information here that you can read through.
We had now looked at basic field types, or common field types. [00:35:09](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m09s) If there are any other field types that you need help with, please look up the Joomla documentation since the implementation is more or less straight forward. We aren't trying to redesign the wheel; we are simply trying to implement Joomla's way of doing it. If there is a field type you need more information on, you can look at Joomla's documentation on that field type. If they don't have documentation then you can go into the field, like I said, libraries. [00:35:41](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m41s) There are three places to look in the libraries' folder: CMS, Joomla, and legacy. These are the places where these fields can be found. If you look under the CMS folder, you have captcha field type, chromestyle, content editor. So if you want to know if there are more attributes that can be used in editor you can open the editor and look through the code and see the attributes that are being implemented across the board. [00:36:06](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m06s)
**Translation brief overview**
### Translation brief overview
If you see that there is an attribute that we are not already targeting you can go to the field type, open it, add the attribute, add the name, add the value, set whether it's mandatory, and set whether it's translatable. [00:36:37](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m37s) Whether it is translatable or not, is an important concept. Not all fields are translatable. When a field is translatable, component builder basically translate it for you. If you look at this acronym, for example. I added the label as 'acronym,' then, while the component builder builds this field into your component, it takes that value, [00:37:17](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m17s) converts it into a translatable string which adds it to the language file, and then adds that in here so if somebody updates the language file it updates everywhere in the system. This basically means that languages are implemented everywhere in component builder's components. All the components it's building, it translates; as well as everything that you set to be translatable. If we look at a certain field type, like text. [00:37:54](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m54s) Any property that you set to translatable means that component builder will dynamically take the hint and translate it into a language string, add it to your language file, and replace the XML with the language string. [00:38:31](https://www.youtube.com/watch?v=9NO2rKnC6Ug&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m31s)

@ -2,20 +2,20 @@
In this tutorial we are looking at admin views, the next step of developing your component. First we started with field types and how to set up and improve on them. Then we learned to use those field types to build basic common fields. Now we are going to take those fields and add them to admin views. [00:00:34](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m34s)
**Naming Convention**
### Naming Convention
Admin views, like I explained in our initial General Planning tutorial, forms the basis of your component's database structure. Admin views is where your database structure is being developed. [00:00:56](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m56s)
All admin views have their own table. They have a single name, a list record or a plural name. Then there is a system name. The reason why there are three is that when you want to reuse a specific admin view in another component with the same name, but adapting it to that component, you would then have two of the same names showing up in your selection list when you add it to the component. [00:01:21](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s) It might then be difficult to discern which is which, hence you can add the name of that specific component as part of differentiating between the same names. [00:01:47](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) That means you can have admin views with the same names, but with different implementations. That is how you can do different version control concepts on components, using the same admin view, making a few changes inside of it, and then saving it. [00:02:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m03s) You can open the name, type free version, and save as copy. You can then change some of the fields that are linked. You can change some of the linked views, your CSS, or whatever other things you have done regarding this admin view. [00:02:25](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m25s) Now go to the free version of that component and link that specific view instead of the other.
**Creating an Admin View**
### Creating an Admin View
Click 'new' to create an admin view. [00:02:54](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m54s) I'm going to open preacher, because it's the one we are using as our illustration. You'd see that there should be a name for a single record. That is where you would edit these records. (In this case, it is preacher.) Below is a list of records that are 'preachers'. [00:03:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m14s) There is a short description and a normal description, depending on what you would like to say. There is a type; 'read/write' and 'readonly' which changes the component's editing view. If you say 'readonly,' the fields wouldn't be editable. [00:03:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m36s) The 'Modified By' field cannot be edited because it's done automatically, and when it was modified, it updates every time you click save. [00:04:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m02s) If you leave it on 'read/write,' you will be able to edit it.
**View Icons**
### View Icons
There is a place for an icon. (If you hoover over the icon it gives you the dimensions that is needed.) When you look at the dashboard, those icons there are the ones selected. [00:04:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m24s) The icon has two options: 'Add Icon' and 'Icon.' If you hoover over 'Icon,' you should see the images if they are set in your images folder. [00:04:46](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m46s) If you open this, it goes to your image folder where you select the icon. If you are going to add a field called category that is of the category type, then you should add a category icon. [00:05:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m14s) Since the system will then automatically know that there has to be a category setup, and will look for a category icon to use for that category. If you select a category field that is a general category for the whole component, which isn't directly linked to this view, it will take the first view (the system, when processing, will see which view is first, which would usually be the first one you've created) and use the icon in that view. To be on the safe side, if you are using one category for them all, set the same icon on them all. [00:05:37](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m37s) If you are going to use a category which is primarily focused on the preachers, and you are going to put preachers in a category, you need to add a category icon for categories. [00:06:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s)
**Permission Implementation**
### Permission Implementation
The permission switch is related to accessing and updating of data. Here we have admin views edit, admin views edit state, admin views edit own, admin views create, admin views delete, admin views access, and admin views edit version. [00:06:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m24s) If you are in the managing group and the particular edit is set to allowed, you can edit it. If you are a guest and it is set to deny, no matter where you are in the front or back of the site, (even if you have a direct link,) you won't be able to edit this information. [00:06:49](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m49s) It does has view access so that somebody who might be not allowed to edit, can still view the content in the back end in the list view. [00:07:08](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m08s) It will show in the list view, and they can see that it is there. You might want to display the record and leave a custom admin link to the data. [00:07:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m32s)
@ -35,19 +35,19 @@ These are the custom default features. [00:17:05](https://www.youtube.com/watch?
One of the features that makes Component Builder far more advanced than other component builders is the ability to add permission structures to your component right inside of component builder through this permission switch. [00:19:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m02s)
**Tabs**
### Tabs
The tab structure. We call these tabs. (See video.) [00:19:27](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m27s)
* **Publishing and Permissions: Example of What Tabs Can Be**
* Publishing and Permissions: Example of What Tabs Can Be
'Publishing' and 'Permissions' are tabs that are built automatically for all back end admin views. [00:19:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m43s) All admin views have 'Permissions' (only if set) and 'Publishing.' In 'Publishing' we bundle the fields that are built dynamically, without you having to set them. [00:20:09](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m09s) All the fields that you do not need to set are always placed in 'Publishing.'
* **Example: Preacher**
* Example: Preacher
In 'Preacher' I set up two tabs: one called 'Details' and one called 'Sermons.' [00:20:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m32s) So there are two tabs in 'Preacher' which means that if you were to open the 'Preacher' back end view the first one would be called settings and the second one will be called sermons.
**Linked Views**
### Linked Views
When you create fields you'd see a column called tab in which you'd select a number, from one upward. [00:20:53](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m53s) Because we are using a different location than the tabs, we don't use the names. [00:21:15](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m15s) When you set up a field, you need to tell in which tab you want to place that field. That is what the tab number is all about. [00:21:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m35s) You might wonder where tab two's information is. 'Sermons' is actually a table on its own; there is an admin view called sermon, and it has its own back end view and structure. [00:22:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m02s) We created a thing called 'Linked Views' to get the 'sermons' related to this 'preacher' to show in the second tab, 'sermons.' (See video.) [00:22:25](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m25s) Selecting 'sermon' as the view, I set it to be placed in the second tab. The 'Parent Key' would be the view in which you are the moment that you are setting up the linked view. [00:22:49](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m49s) It depends on the view you are editing. Hence, if you are in 'preacher' the parent is 'preacher;' if you are in 'sermons,' the parent is 'sermon.' So in this case, when we talk about the child key ('preachers') it would be the database field name that is to be looked at. [00:23:10](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m10s) The parent field name ('id') would be found in 'preachers.' [00:23:38](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m38s)
@ -59,35 +59,35 @@ The basic way of linking another view would be to select that view from 'Sermons
Open the admin view. (See video.) [00:29:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m32s) Go to 'Linked Views.' There is an 'R' in the pointer as well as the word 'field.' If you are trying to connect a view from the parent, (in the parents it is stored in 'addfields' which is the database column name) go to database and 'componentbuilder_admin views.' [00:29:54](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m54s) You'd see 'addfields.' You'd see that there's a way in which your repeatable fields are stored by Joomla. [00:30:21](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m21s) In the repeatable field called 'addfields,' there is a field called 'field.' It should look for the ID of the fields in addfields in the field array for the IDs that it need to fetch. [00:30:51](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m51s) To connect a linked view you should set this as a capital 'R' for repeatable fields. That is the convention telling the system that it is a repeatable field we looking at. [00:31:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m14s) Inside of the repeatable field we must look in the field array for those IDs and they should map to the child's ID. If that wasn't a repeatable field but an array, you would simply say array. [00:31:34](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m34s) If the array is the values themselves you would drop off any pointer to the specific value. If it's an associative array you would add the name of the associative key that it needs to look in; if it's a normal array without association, leave it like that. This is so that the system would know that it is a array and it needs to look inside of those values for these IDs. [00:32:00](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m00s)
**Setting Up Fields**
### Setting Up Fields
Since we already created the fields beforehand you will start out this way. (See video.) You would scroll down the fields that you created. (If it is a long list you can type the field's name and it will bringing it up to you.) It asks whether you'd like to show the field in the admin list view. [00:32:56](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m56s) That means that there is a list of names if you close your editing area; if you want that specific field to show up in this list you'd select 'show'. If you select 'show,' you can set in which order you want this. (See video.) [00:33:18](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m18s)
In Joomla the title and alias concept is quite interesting. [00:33:41](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m41s) It's needed, especially if you want to do history control or integration with Joomla's infrastructure when it comes to their history and tagging systems. You need to add a title and an alias to all your views, especially if it is a view that is going to be used in the front. [00:33:59](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m59s) In this case, since we are going to use preachers in the front to display a list of preachers, we are going to add a title, using the name as the title. Back to the back end. There you can set if you want this 'sortable' or 'clickable;' you can click on this, and it sorts the table alphabetically on the basis of this column. (See video.) [00:34:30](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m30s) Do you want it to be searchable? Do you want someone to type into this box and show only a specific field? [00:34:51](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h34m51s) The filter option is a tricky one. You don't want to set name to filtering because then it will show a list of all the names that are already being shown in the table. You only want to use filter on things like a radio box, another view, or fields that aren't being displayed one after the other in the table. [00:35:19](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h35m19s) I added no extra fields in sermondistrubutor, but at sermons I added preacher. There's a list of all the preachers here, through which you could sift a chose which to show here or not. The way that you set up the filter is by clicking yes or no here. If you are setting up a custom field and in the display of the list have it clickable, this link is used. [00:36:12](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h36m12s) For example: I can click here and go to that preacher. I click close and then I'm back in the sermons list view. I could click on series and it will take me to the series; I can edit the series immediately. I click close and I'm back in the list view. We usually use the name to be the clickable title. If you select your title here and click link then you're saying that this field item here is what we should use as the clickable option to open that sermon. (See video.) [00:37:16](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m16s) That is the way for us to know which field should be used as the clickable field if you have a title. Since it is so easy to change, you can study this concept. Just click a button here to compile your component, install it, look at its behavior, change it a little, compile it, install it, look at its behavior. By doing that you would get a good understanding of what happens if you change these switches here.
**Field Alignment**
### Field Alignment
We said that we wanted the preacher's name, etc, on the settings. Our tab for settings is the first tab. (See video.) We are looking at the back end setup where you want to have this field's display. There are different placing options and an order in which it should go. (For example, see video.) [00:38:20](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m20s)
* **Field Alignment: Example**
* Field Alignment: Example
Let me go to this one, 'Add Question'. (That is right of the tab, not in the tab.) You see an option which says: right in tab, left in tab, and left of tabs, right of tabs, etc. That means that you can put it outside of the tab area. Even if I was to click here it will remain displayed right there on the side. That is to put it right of tab. There's also a left of tab area over here. [00:39:31](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m31s) Above tab is this one here, above the tabs. It shows all the time. Then there's underneath tab. We added the option of placing data. At the right in tab, left in tab, right of tab, left of tab, above tab, and beneath tab which is six positions in the back end of your template. The places are being set by these alignment assignments here (select the field alignment inside the tab view) and you select these (from a list). This is the order in which you wanted them to display. [00:40:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m35s) Full width will always display under the left and right of in tab. You need to select your left and right and then your full width. Full width is the last thing to show up in a tab. Here is the switch to add permissions to specific values. If I want to control the group that can edit the name field, simply click this 'yes', and this field would be added into the permissional structure dynamically.
**Fields Title**
### Fields Title
You can only have one title per view and only have one alias per view. [00:41:39](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m39s) You shouldn't have more than one selected. The system will ignore the others any how, but just to be safe set the others to no. Be sure to use the correct field values. When you set any of these to show, you should set the order of their display here. (See video.) The filter is added dynamically by simply clicking a yes here. (See video.) If we go to sermons as an example, and we click on their fields, they have many fields which will help illustrating some of these things. You'd see that we have sermon series and we have it set up as a filter. [00:42:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZW) So then that is how you can use the text field. This means we can sort these sermons by series.
Remember this is primarily for the back end. Although some of that information will relate to the front eventually, this permissional switch will be able to access it from the front if you need to.
**Conditions**
### Conditions
Conditions is an amazing feature which goes beyond Joomla's control on the showon attribute per field. [00:43:47](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h43m47s) Remember we looked at the showon attribute: it can control which fields to show when you are clicking on other fields. For example, we have a field called 'Add JavaScript.' If I click 'yes' it opens this area, JavaScript, where I can add custom scripting. This behavior is being controlled by the conditions structure.
* **Conditions: Example**
* Conditions: Example
The condition structure for sermons is the following. (See video.) You'd see a few had already been set. We'll first decide which field we are targeting, which field we want to show or hide. [00:44:51](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m51s) Most of the time we'll use the option 'show.' 'Show' means it will be hidden unless this criteria is met. Here is the list of all the fields in your system. (See video.) You need to remember which fields you selected in the fields area. For our purposes, these are the fields. Remember their names. When you go to the conditions and you type a field, you need to know which one it is. That is how you would link to them.
**Isolate and Chain Function**
### Isolate and Chain Function
This isolate and chain function is a concept which would be best explained when you think that more than one field must be used to show the other one. [00:45:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m55s) In this case Dropbox Auto Note (in sermons) should not only show when the field's source is Dropbox, but also when Built Option is automatic. Hence both of these should be true before it shows the Dropbox note. You would select the field you want to control. You can control more than one at a time, but the logic behind this might not always work so you need to try and test it. If it doesn't work, tweak it until you find it behaving the way you expect. Most of the times you would only link one field to one validation. [00:46:59](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m59s) However, as soon as you have multiple fields, you would use the chain option. The build option of files should show when the file source is Dropbox and it's isolated, not connected to any of the other settings here. As soon as you click chain, it means any other row that has this field will be chained together. So both must have been validated as true before it will show the field. Here it says file source. You can select any of these if you know that this file source is a list, you can see the list options. (See video.) [00:48:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m03s) You can say 'is' or 'is not.' If it 'is' Dropbox, then it should show; if it 'is not' Dropbox then it should show. That is the the logic behind it.
@ -103,19 +103,19 @@ If you know how to improve this then you are welcome to get involved on GitHub a
Let's go back to the admin views. This is a structure that you can use to manipulate the conditions, determining which field should show or not. I think we have done a good implementation here. It gives you many possibilities of structuring, chaining, and working with fields in their relationships. If you don't want to use this and only use the on show, it's going to work just as well. The only problem with the on show is that it doesn't provide the ability to target a text field like we have here. [00:58:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h58m43s) You can add a keyword and immediately the other field will show up. Furthermore, the on show option cannot look at multiple other fields if they have certain values; also, if it evaluates true, it only shows the other field. Those kind of controls are not yet available in the show on implementation. I would like to get involved on the get repo of Joomla and see if we can add these nice features.For now we added them to Component Builder. In component builder you can implement these. We are writing the JavaScript to manage this for you. [00:59:47](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h59m47s)
**Field Listing**
### Field Listing
We looked at permissions, tabs, fields, conditions, and linked views. The next one is the list of the fields that you have already selected and saved. If you want to update any of these fields, you could just click on the field name and it will take you to the field where you can update it.
**Custom CSS View**
### Custom CSS View
The next tab is a place for you to add custom CSS that is related to your specific view. You can add CSS here, which is for the edit view or the single view; or you can add CSS here, which is for the list view or the multiple views (plural). (See video.) Now it will be placed in its prospective places. The same goes with the JavaScript, except that you'd have four places to target instead of one.
**Custom Javascript View**
### Custom Javascript View
When we looked at the way that we are building the JavaScript, you'd remember that there was a JavaScript file, which has JavaScript for the view. [01:00:51](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h00m51s) There is also the footer area which is under the HTML and PHP at the end of the file which is just JavaScript. We decided to add the option of adding JavaScript to the file or to the footer. It just gives you the option of targeting. If you know list this script can run as a function. You add it to the file and, if you want to use the function, you can add it to the footer.
**Adding AJAX Via the Controller and Method Implementation**
### Adding AJAX Via the Controller and Method Implementation
There is a php area where you have the option of adding JavaScript to your editing view primarily. [01:01:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m55s) Looking at editing views, the moment you click on 'Add JavaScript,' it opens a tab. The way that we want to implement AJAX is via the controller and method implementation. The component has a controller called ajax.json.php which has a model called ajax. So you have a controller and a model. The controller is like the gatekeeper. It does a few checks and balances to ensure that the data is correct and the token is right. If you had set this to validate whether he is a user or not, it also checks for a user ID. [01:02:59](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m59s) If you set it that not to require him to be a user, it would drop off this validation.
@ -130,20 +130,20 @@ In sermondistributor, which is the component to which that view belongs, there i
This is where this php script is going to be used. (See video.) I added the Ajax controller concepts here, but the actual JavaScript that fires off all this is set to the global event which means that every time a back end area is opened in this component, it loads that JavaScript to the view. [01:10:00](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h10m00s) JavaScript then executes an Ajax request which starts updating the Dropbox listing. Sermondistributor is able to link to media inside of a shared Dropbox folder. This whole method here that we looking at passes that Dropbox folder every so often to make sure that it's up to date. [01:10:28](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h10m28s) That's what it's all about.
**Get Items**
### Get Items
If you know the Joomla API, you know that it has a 'getitem method' in the model. [01:10:45](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h10m45s) In the model there's a 'getitem method' in the editing model; in the list model there is a 'getitems method'; there's a 'getlistquery' in the 'jmodellist,' a 'safe method', a 'postsavehook method' in the controller and an 'allowedit method'. [01:11:10](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h11m10s)
There's a 'batchcopy method', a 'batchmove method', a 'script before delete method' and a 'script after delete'. These are all PHP places in which you can dump custom scripting.
**Save Method**
### Save Method
You need to know where the 'save method' is. Open 'sermon' and scroll down to 'get item'. You can add custom scripting to the 'get item method'. [01:12:06](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h12m06s) There is 'save method.' If we go back and click on the 'save method' you'd see the PHP here that should run in the 'save method'. You have the $data. It's an array and is called $data. [01:12:27](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h12m27s) It means that you're able to target that value. It gets placed into 'save method'. [01:12:47](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h12m47s) Your custom value code will probably be placed in before '(parent::saved($data))'. If you do not know in which of those custom scripts the code will be set, type it. [01:13:06](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m06s) It is loaded here. Save it, compile the component and then look at the code. You will see where it is showing up. You have all these values already in the script. (See video.) [01:13:37](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m37s) It will add the string. When the component runs it will treat it as code. It is a comment but if it was code it will execute. It is the way to add custom scripting right into your component.
**Post Save Hook**
### Post Save Hook
The 'postSaveHook' is in the controller, not in the model. [01:14:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m05s) Go to the controller 'sermon'. Scroll to the bottom and find 'postSaveHook'. It gives you the model and the valid data. You can perform extra features on it. [01:14:27](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m27s) In all these things you should read the description. The PHP here should run in the 'postSavehook' Method; there is the $model, the data model and the validated data. If you just read our note here, you can start coding for it.
**MySQL Dumps Test Data**
### MySQL Dumps Test Data
You can do two kinds of dumps. What is this used for mostly? Often, while I am busy developing, I'd set up a component, install it, then add dummy data to it to see if it works. [01:15:15](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m15s) Every time I make a change and uninstall that component and install the new one, whatever change it made to the database won't be added to the database via an update. You need to uninstall the component and install it again to get the database back to where you want it. The only way I could save time was to re-install this component and the dummy data for sermons I would like to retain. [01:15:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m43s) Open the tables where it will show a list of all the tables that are in the database at that moment. Scroll to sermon table. Click on it and it will load the table and what it should be called in the data set. [01:16:06](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m06s) Let's say you want to have it mapped to multiple tables, then this 'Source Map' is the explanation on how to do that. I won't recommend doing this because you might not get what you expect. [01:16:29](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m29s) Going with the values that he populates for you would probably be the best, unless those values change and if you are making changes or adding new fields. You need to reset this by clicking on something else. Click on it again and it loads the new list of fields that are related to the table to the back end view table. [01:16:57](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) In that way you compile the component, while the component builder grab the data from the database and build a dump file for you. (See video) [01:17:18](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m18s) This might be a little bit complex but it saves time. Another way to do it would be to do a dump file itself. Go to your 'MySQL', open the specific fieldtypes, click on export, select SQL format, and click 'go'. [01:17:40](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m40s) This will create a dump file of all the data in the table. You can paste that dump file in here. [01:18:17](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m17s) Click 'export', 'quick', SQL, then 'Go'. Save it. Open cb componentbuilder_fieldtpye.sql. [01:18:41](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m41s) Replace 'cb' with #_.' Click 'Replace All'. You won't use the table structure because it is already in component builder. You just use this area here. (See video.) [01:19:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m03s) You would copy this area, cut, go tp MySQL and paste it there. Save. You now have the dump file. It will be added to your new install. [01:19:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m36s) If a dump file is too big, you will see it after your clicked save; look at the end and see if it had cut it off somewhere. If it had, the dump file is too big for use. (For example, see video.) [01:20:04](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m04s)

@ -2,7 +2,7 @@
There are a few advanced field types. The most advanced is one called custom field type. Sorting by custom fields, you will see that we have quite a few custom fields in place. [00:00:32](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s)
**Setting Up A Folder**
### Setting Up A Folder
Let us look at two of these. One is the local file list, the other one is 'sermon'. We'll look at the local first. You will see that the whole 'XML field definition' column is PHP. I'm creating a view that is taking information from the global settings of your component so that there need to be a field with a name 'localfolder' in your global settings. When we get to component we'll look at setting up global settings. If it doesn't have a setting it falls back onto the image which is in the 'JPATH ROOT'. For your component this will be replaced with your component name. It places it into local folder. [00:01:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m36s)
@ -10,17 +10,17 @@ Now I start the options array, which you are going to return. Select 'Please add
There is a field type called 'file list'. I didn't use file list because file list has a static directory to where you need to add the files to view them. [00:03:44](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m44s) We want it to rename the folder for the files, for the media, etc. then have it update itself automatically. So we created a custom field where we extended the list type. We chose a custom field, and then extended the list type. (We don't want it to add 'new button' because it won't work.) We are allowing them to select multiple. Since we are using multiple, we need to make sure that we are storing it as a 'JSON'. That is when you have 'multiple' or 'arrays', or any kind of arrays in a value that needs to be stored as a 'JSON'. [00:04:48](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m48s) The component builder itself will check if the multiple selection is true and automatically store it in a 'JSON' object even if you forgot to select 'JSON'.
**How to Create a Sermon Preacher Custom Field**
### How to Create a Sermon Preacher Custom Field
It is a preacher custom field. It will show a list of preachers, but will display the preachers that are set up in the preacher list view. Open that 'Sermon Preacher.' [00:05:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m52s) The convention is that you should call the type, preachers, that is the list view name. You should use the same as the editing name which is preacher without the 's'. If you go back to your admin views you would use this name as the name of the field, but you have to use that name as the type because you are now creating a custom type. The logic behind it is that while it shows a list of preachers, you might have selected just one preacher.
You can use any label you like, whatever is descriptive enough for your user to understand. There is a place for adding a description. In 'XLM field definition' we set multiple to false. They should be able to only select one preacher at a time. At 'Default 0' all are left to their default values. [00:06:56](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m56s)
**Jform in Component Builder**
### Jform in Component Builder
'Extending list' is the most common custom field that we have. If you want to receive a list of custom fields that is available, you can go up here to 'extend' and see the list, radio, and check boxes that are available. User is also a user option to extend users. If you want to see what is available, look at that name 'Jformfield' and go to component builder. Go to the back end of component builder. (See video.) Go to compiler, then to Joomla 3, which is the current version we are targeting. Search for that Jform. [00:08:00](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s) Those available to extend are user, Jform field, JForm field user, Jform field radio, Jform field list, and Jform field checkboxes. This means that if there is a form field you want to extend that doesn't exist in our advanced seminar, you will be shown how to add your own form fields here. There would be two places you need to change. One of them would be adding the field and update it accordingl; the other one would be adding it in the code at some places and in a Json file called settings there. These are some of the things we will deal with in the advanced adaptation of component builder. [00:09:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m04s)
**Extending List in Custom Field**
### Extending List in Custom Field
Getting back to extending a list field: you simply add list. There are a few conventions. One of them is that if you are going to be targeting 'Preachers' for example, you will be using the preacher table as the table being targeted. The question to ask is where the data going to be found. This table needs to be added. (See video.) The reason why we have this 'component' here is because it's a placeholder which component builder will replace with the component's code name once it's built. [00:10:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m08s) We added this feature because sometimes we want to rename components. If you had statically added the actual component name there, you have to update that name in every field and view.
@ -30,49 +30,49 @@ In all the custom coding that you're adding where you need to use the components
The list view (or the views plural) would be the add value there. All lowercase too. The value field is the field that the user will see. It 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, which field do you want the user to see? The name of the preacher. Inside this table, which field would you want to store in the other database? We are going to store it wherever the 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. [00:14:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) It will be called preacher. To show that in the database itself. Open it. (See video.) Go to sermons, click 'new,' and you will see a place for preacher. If you were to look with firebug at it, you'd see that it is the name is preacher. (Remember we spoke about this Jform_ as the ID.) It's simply the preacher field which is being stored directly in the database in the preacher column of the table. [00:15:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m28s) It's stored as INT 11 and we say that it is a key. We can target it. If we look at indexes, we'll see that it had added it as a key.
**Custom PHP layout in Field Definition**
### Custom PHP layout in Field Definition
All of that is done in the database structure and in this area. (See video.) Here you can add your own custom PHP. I'm using 19, 18, 17, etc so that it's creating line breaks and spacing and tabs for me dynamically. I could have placed them all under PHP one, without these quotation marks. [00:16:32](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m32s) We wrap around them like we did with the file folder list view example we did previously.
(Just a note: inside of this code, you can't use quotation marks; you need to use single quotes, even if you try to do an escape. It will not behave as you might expect.)
**Build Code for Sermon Preacher**
### Build Code for Sermon Preacher
These place holders reflect back to these 'key_field_id' values. (See video.) Basically, 'a.###ID###' will be written here and the text value which is the field value is going to be called 'a.###name###' and then '###ID###' and '###code_text###'. [00:17:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m36s) This code is built up by the view that we are in, as well as by the text, so it would read sermon preacher in the code.
* **Example (See Video)**
* Example (See Video)
To show you how it looks when it is being built. Open jformfieldlist. That is what it starts with, replacing this place holder with your code. It replaces all these features up here as well. [00:18:30](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m30s) Everywhere you see '###component###', it will be updated through component builder. Everything here will be replaced with your licensing tags. Let's look at the finished product. Sermon is placed on the module field and there is 'preachers'. [00:18:57](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m57s) If you open it you'd see that it added preacher there, and the input added. If you trip that switch, like we have explained, to show the line numbers in your component. It shows you in what file. [00:19:15](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m15s) These files are found if you go to component builder, helpers compiler. These are the files that are being used to compile your component.
**Generate a New Button**
### Generate a New Button
We are trying to build a component, not as yet to extend component builder itself. [00:19:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m40s) Here you can see where in the code it is building, compiling, and putting this together. [00:19:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m59s) This is used for the button. (See video.) This is to generate a new button. When you click on new, this is the button. This area is generating the button. This controls whether the button should show up or not. [00:20:21](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m21s) If it is to be set at all, this is what generates the button. We said that the 'get options' will show the name and 'ID'. Going back to our structure here, we dynamically replace these (###ID###,###name###) with 'view preachers'. The reason for this is that it's done a few times. [00:20:48](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m48s) We'll say that you only need to update these values and it would get updated all over in the bottom of the code. It makes it easier to change your custom fields. A field called preacher name was built. Which again used 'preacher_name' as an object value. [00:21:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m17s) Because it retrieves the object from the database and it seems as if the object exists, it reiterates and builds up option list which is returned to use in the drop down. It dynamically generates your list. So component builder through this infrastructure compiles all of the code for you and puts it in the right file in the right place.[00:21:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m37s)
Once you have built a component and know where you have made those changes in component builder you can look at the 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)
**Dropbox Custom List Example**
### Dropbox Custom List Example
We will now look at Dropbox manual file list, which is more advanced. [00:22:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m36s) We are dealing here with a file that is stored. I created a function in my component global helper function called 'getDropboxlinks'. It wants manual links and passes a specific variable '2'. [00:23:02](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) It would return some links which it will check to see if it exists. It will check the array and the values in it. If it does, it backs it into the options and gives it over to the options array, to the list. [00:23:24](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m24s)
**Component Helper Class**
### Component Helper Class
This part means that you can add a helper static method call in your custom field types. [00:23:44](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s) These two symbols mean that it is a static method being called from a class. If you know the Joomla API and how to work with builder component, you will know that you can add a component helper class to any component. [00:24:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m07s) If I go to sermon distributor, the component helper class is always located in the helper folder of the admin as well as the site view. The admin is in the back end in which is administrative components. [00:24:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m28s) There you'd see the component and its helper folder. In the front end you have the same convention, component, and sermon distributor. There is the helper structure. Here is some of the script of sermon distributor structures through its helper structure. There is the helper file for the front. Here is helper file for the back. (See video.) [00:24:49](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m49s)
**Adding Methods to the Helper Files**
### Adding Methods to the Helper Files
If you want to know what the custom helpers are that we ship with all components, you can open component builder. Go to the compiler and Joomla 3 then look for the helper file in the site helper file. [00:25:30](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m30s) If you open it you'll see many helper methods. With a lot of place holders we customize for each component that targets that component. You'd see a Json to string method here to 'getvars'. (See video.) There's a 'getvar' singular. This is getting one variable from the database so you don't need to rewrite the whole string to get one variable. [00:25:55](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m55s) You can look at how this works and use it to get a variable from the database. We also have 'ispublished' to check if a specific object is published. [00:26:14](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m14s) I wrote these functions. (See video.) [00:26:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m40s) If you do savestring we change every number in the string to text, so that you can be sure that whatever you get back from savestring doesn't have numbers in it. [00:26:58](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m58s) In this way we are insuring that it is always text. It's is quite necessary, especially if you don't know if the first character might be a number. [00:27:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m20s)
**Strings**
### Strings
There are many custom methods that we ship with all components that are developed. [00:27:40](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m40s) If you were to open 'sermon distributors', 'helper class', you'd see that these helper classes are all showing up. (See video.) [00:28:00](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m00s) If you have a better way of doing this, please go on the forums at Github and bring it to my attention. I recently tried to improve on this checkstring by doing adding {}. The plan was that I could dump this part(&& strlen($string)>) and save on the query. [00:28:22](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m22s) But for some reason it started causing problems and strings were being returned as non-strings. [00:28:41](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m41s) So I went back to the old school way of doing it. We first want to ensure that this value is set. If it is a string, then it has a length. Something can be a string and yet not have a length. [00:29:04](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m04s)
Back to the UI. That is where I get these values where it says 'getDropboxlinks.' (See video.) [00:29:29](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m29s) We see that it has '$return' set to false. It means that if it should return the manual values, then it will only return the value manual links. Since I've set it to 2, it will return all of those links because you can target that it should return one specific sermons link. [00:29:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m52s) This method is dynamic. That is all I am calling in this advanced field type which is called 'custom field' and it gives me an array of all the links which I have loaded. [00:30:15](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m15s) It is an advanced implementation of these custom fields. [00:30:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m37s) With that list concept you can nearly do anything, even grab a bunch of website names from somewhere. You can put any PHP in there and build a list which can be used to save to the database.
**Custom User**
### Custom User
There's also a function called custom user. [00:31:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m08s) In the custom user, you don't need to set or change anything here. (See video.) [00:31:25](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) All of these should just work. The only part that you want to consider removing would be the PHP here. (See video.) What this does is it limits the user list to only a certain group. [00:31:47](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m47s) It means that you need to set up a global value in your component field. In the Global, as mentioned previously, if you click on 'options', it opens a place where you need to set 'global'. [00:32:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m07s) These are all global values. This is an area for global values. You can get hold of these global values through the component helper 'getparams' with a component name and get. (###text###) You would place the field name. [00:32:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m28s) That's how you can get a value from your global settings. I'm getting a specific groups value and placing it in here. Then I return that group. That is what this is doing. (See video.) Those two sections are independent. This one is the one that helps you set to return a specific group. [00:32:52](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m52s)
* **The Exclude Feature**
* The Exclude Feature
This part helps you set any users you want to exclude. This specific feature here ensures that only one record per user is set. (See video.) Let's say a user had already been added to a previous record, then that user should not show up again. [00:33:18](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m18s) The user should be removed from the list. This is what this PHP is doing. It looks to the current view and checks if there are users; it gets their ID's and sets them up in their unique manner, then returns them. [00:33:36](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m36s) If you are building something which are supposed to have student details, for example, you don't want a student to have more than one entry in that table; you want every student to just have one. [00:33:58](https://www.youtube.com/watch?v=VpzYbifHTMLqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h33m58s)
@ -80,19 +80,19 @@ Now to show that to you in the code. Let's go to another project that I am worki
Here is a select list; here you have the values. That's the IDs and the actual name of the speaker. This is how it should display the data. Component Builder sets up the XML structure that Joomla uses to build this. [00:37:53](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h37m53s) Joomla is building this whole structure for you. It is done through these XML input values that you are adding here. [00:38:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m08s)
* **No Underscores or Spaces**
* No Underscores or Spaces
Something to remember here: the type names may not have underscores or any spaces in them. Anything that isn't translatable usually needs to be without spaces. [00:38:35](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m35s) You must also remove the underscore. You can use uppercase but it will be become lowercase anyway. [00:38:57](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h38m57s) This works because it isn't only used in the file database but also in the name convention and everywhere this file type is. You can see in here that the file type is called studentusers and even the file is called studentusers. [00:39:21](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h39m21s) Specific type name is used everywhere.
You can update these fields. Mostly they are fields that are related to all the other fields. [00:40:07](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m07s) This one specifically says extends user. It shows you how it's going to extend it. If you removed all the PHP, the field like this will show all users every time. [00:40:28](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m28s)
**Repeatable Custom Fields**
### Repeatable Custom Fields
Repeatable fields aren't that difficult but you need to understand how it's structured. First you need to create the fields that you want to repeat inside repeatable fields. [00:40:55](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h40m55s) This is a repeatable field. (See video.) If you know a little XML and worked with repeatable fields, you'd see that the fields are being repeated inside of the repeatable field. [00:41:23](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m23s) Repeatable field is a field type that has other fields inside of it.
You don't need to write any of this. It's very simple to structure a repeatable field. [00:41:47](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h41m47s) First you create the fields that you want to repeat. You can't use repeatable fields in repeatable fields, but you can use custom advanced fields in repeatable fields.
* **Cause and Risks**
* Cause and Risks
Here is a field type called 'cause and risks'. (See video.) If you know Joomla you'd know there is no such field type. That means that this is a custom field. If you were to go to fields, you'd see a field called 'cause and risks'. [00:42:16](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m16s) It gets its information from this database table. This is another component that I've done with component builder. [00:42:35](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h42m35s) It is displaying that data, making some model changes and adding some style to the data.
@ -100,7 +100,7 @@ You're able to add an advance custom field inside of a repeatable field. However
Here I developed this specific pop-up repeatable structure. (See video.) Here is a list of all the repeatable fields that I've already built. There are three pages of 20. [00:44:08](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m08s) If we were to click on add fields for views, this is the repeatable field for adding fields for views. [00:44:37](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m37s)
**Joomla Icons**
### Joomla Icons
If we go back to the view, you'd see that it says add. I'm adding an ID in a class to it. A description would appear if we were to hover over it. It has a little setup field for this view which is the description. [00:44:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h44m59s) The label is fields; the icon is what is shown in the button, a list. [00:45:17](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m17s) All those custom Joomla icons can be used. To know these icons you should go to URL Docs.joomla.org/J3.x:Joomla_Standard_Icomoon_ fonts. You'll get to Available Icomoon Icons. [00:45:41](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h45m41s)
@ -108,7 +108,7 @@ These are all the available icons. You use contract-2 and checkmark-circle. If I
These are simply the ID's of the fields I want inside of the repeatable field. [00:46:22](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m22s) You'd find the IDs next to the fields on the right if you close repeatable fields. You'd create the fields that you want to use in the repeatable field and get a list of those ID's jotted down somewhere. [00:46:51](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h46m51s) Add them in the order that you want them to be added. Inside of your repeatable field paste it in the fields area with a comma separating them. Then component builder will dynamically construct the whole structure for you and add it to your component. [00:47:11](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m11s)
**Radio Buttons: A Note**
### Radio Buttons: A Note
A note: you need to remove the class of the radio buttons you use in the repeatable fields. [00:47:39](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m39s) It can't be a button; it must be a dot. Unfortunately they don't make it possible to load the button. What's the difference? [00:47:59](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h47m59s) CSS YES/NO is the button version of a radio button. Searchable Yes/No is the dot version of the radio button. It doesn't look like a button. [00:48:20](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m20s) What makes it a button? It is the class that is being added to the field. You need to remove the class values from your radio button if it's going to be used in the repeatable field. [00:48:38](https://www.youtube.com/watch?v=VpzYbifqv0M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h48m38s) If you forgot to do that and compile your component you'll see that the radio button is not working if you look at the repeatable field, but that it messed up.

@ -2,51 +2,51 @@
We've looked at setting up admin views and creating fields for admin views. We've looked at setting up field types and how to use field types to create fields. Now we'll look at setting the admin views to the component and all that can be done to the component. [00:00:28](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m28s) First we will look at adding the admin views to a component. Go to components, sermon distributor, and settings. There you will see admin views. [00:00:59](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m59s)
**Sermon Component Setting as Example**
### Sermon Component Setting as Example
To connect admin views to your component go to settings and open this button here. (See video.) Select an option and click 'next'. Do the next one. If you have a lot of admin views, type in the name of the admin view. [00:01:33](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m33s)
**Adding Views Setting Icons**
### Adding Views Setting Icons
Type in the name 'Sermon'. These icons here which have been mentioned previously, are the icons from Joomla called Joomla Standard Icomoon Fonts. (See video.) [00:02:02](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m02s) If you select an icon here, 'Joomla', it will show you that icon (see video) but only during the selection face. That is the icon that is going to be used for the view in the right. Look at the icon (top right) as we click through component builder; it gets updated. [00:02:24](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m24s)
**Settings Switch Admin Menu**
### Settings Switch Admin Menu
This icon is what is being set here. (See video.) You can select the icons to reflect the admin view of your choice. We have a bunch of switches here that we'll look at one at a time. 'Admin menu' is the menu. [00:02:49](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m49s) Do you want that view to show up next to your main view? That will be the first tick box, yes.
**Settings Switch Dashboard Items**
### Settings Switch Dashboard Items
Do you want to have an 'add record' icon for this view? If you go to the dashboard it is this icon 'Add Admin View'. [00:03:10](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m10s) It is a shortcut to create an admin view from the dashboard. Say 'yes' and a 'Dashboard (list of records)' icon will show. If you don't want this 'Admin View' icon, just add 'admin view' and tick that 'Dashboard(add record)' as 'no'. [00:03:35](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m35s)
**Settings Switch Submenu**
### Settings Switch Submenu
If you've opened your view it has a submenu here that can collapse away. You can add this view to the submenu or not.
**Settings Switch Auto Check-in**
### Settings Switch Auto Check-in
Auto check-in is a tweak that I've added to my Joomla components. (I'm possibly going to make a pull request to add it to Joomla.) [00:03:59](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m59s) Auto check-in adds a feature to your component. [00:04:28](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m28s) It checks whether this item had been checked out longer than a set period; if it happened to be so, it checks it automatically. The set period is something that the administrator sets in the global settings of the component. [00:04:57](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m57s) You can add auto check-in to a view by either saying 'yes' or 'no'.
**Settings Switch Keep History**
### Settings Switch Keep History
Keeping history of a back end view. The History Component is one of the most exciting things that I have integrated. It keeps track of every change you make in any article or item in your application.
* **Example**
* Example
If I go [00:05:33](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m33s) to preacher open 'A Capella Music' you'd see the 'version' button at the top. I type in Info@vdm.io, set 'Some text here' and clicked 'save'. If I click on 'version', you'll see that it now locked a new version. [00:06:13](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m13s) I could take the one I'm on currently and keep it. It would lock it in because you can also set the amount of history the system should keep. The default changes. I can click on the previous version and say restore and it will be restored it. As you can see, Email address and description is gone. To go back to the one that has been done just click on 'version' and 'restore' and the details are back again. [00:06:52](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m52s) History Component is a Joomla extension which you're able to integrate into your own components as a component developer. [00:07:14](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m14s)
**Settings Switch MetaData**
### Settings Switch MetaData
Depending on whether you are going to use the views information on the front end as your main base for your page, you might want to add metadata. [00:14:23](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m23s) Although Google and others may be ignoring it and metadata isn't that useful anymore, it still plays a role making a page search engine optimized. If you do your homework and do things right in relationship to implementation of your metadata, you'd see that it adds good features to do the front end of your site. [00:14:51](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m51s) I'd suggest that you add metadata when you use a specific area to the front. (You'll be remodeling the data because you can get relationships from many databases. You need the area in the back end to get the data.) [00:15:26](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m26s)
**Settings Switch Access**
### Settings Switch Access
This access switch adds the following feature: if you open an article, and open publishing, it says 'dropdown', 'access public' etc. Those are relating to your user access levels. [00:15:52](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m52s) As you know, user access levels can target multiple groups into one user access level. This is a feature that will be useful when you look at the front end of your component though you can also make use of it in the back end. You can change the access of a specific item but since we also have such intense permissional switches, I hardly ever make use of it.
**Settings Switch Export/Import**
### Settings Switch Export/Import
When you want to add to import/export function. [00:16:38](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m38s) This is an extended area which component builder dynamically adds. You don't need to do anything in relation to scripting at this stage. You could click 'yes' or 'no' to import/export feature at the top of the page of every view. Every view will have an import/export function. It's a direct relationship import/export. If you export this, you'd see how to do a import; if it's is nice you can map the headers to their specific database tables. [00:17:13](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h17m13s) Work is needed, especially when you're dealing with information that was encrypted. If you export it, it will decrypt it if you have the permissions to access that item, but the problem is that it had been decrypted when you imported it, so it doesn't know that it should encrypt it. There is a discrepancy with the advance storing methods. As long as you are having a data back end database table that doesn't require these advance storing methods, it's normal defaults like I explained before. Then the import/export method will works without any problem. [00:18:07](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m07s) The switch here is 'Export/Import data.' If you don't like the feature just click 'no'.
**Settings Switch Edit - Create - Site Views**
### Settings Switch Edit - Create - Site Views
Every back end view has an edit area. If you've selected the read/write option in the edit area you can change the values of that back end listview. The admin create site view means that the system will dynamically build the front area which you then can access to edit the data at the front of the website. [00:18:42](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h18m42s) It's an excellent tool. For example, it takes this editing area and places it on the front of your website. (See video.) [00:19:13](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m13s) In the permissional structures you can control who is editing this, etc. (We looked at adding the fields to your admin views; you could set whether this field should have permissional structure.) It means that if you have those things set up back in the global permissional tab, it will be implemented in the front. [00:19:44](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m44s) If the user is in the incorrect group he won't be able to access this. Nor, for example, update the modified date or the status in the front. You have control over who can do what but at the same time you have the ability to edit items on the front. [00:20:19](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m19s) However, the fact that it creates the view and places it on the front doesn't mean that there is a link somewhere to it. That is something you need to add to your site front custom site as you develop it. Therefore, if you don't know PHP and if you're not familiar with setting up your links on the front of the component, you would possibly find this feature difficult to implement. [00:20:54](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m54s)

@ -2,46 +2,46 @@
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 is done here. (See video.) There is a '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. [00:00:40](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m40s)
**Compiler Info**
### Compiler Info
Component builder its self has a compiler view. It's this view here. This entire view is done outside component builder. [00:01:04](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m04s) 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](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m32s) You would see there is 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](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m02s) 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](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m32s) 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](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m59s) I also have the controller, the model, the compiler, and the helper file. I am including it into my component.[00:03:48](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m48s)
**Adding Custom Files - Folders**
### Adding Custom Files - Folders
In files I'm including a bunch of things and that also means I'm including the 'Compiler' and then I take this file and put it in 'admin views compiler' and rename it. In this instance it got the wrong name. If you add the right name at the end of the string and click 'yes', it will rename that file to this(See video), that is adding custom [00:04:16](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m16s) files as well as custom folders. I'm grabbing the compiler views and dumping it into views, and rename it to compiler, compiler views becomes compiler inside of the views folder. The system will first build the folders and then move your data your files to those folders. You will put the files here(see video). [00:04:44](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m44s) And then have the system do the folders and then it will move the files. That's adding custom files to any component.
**Adding Custom Admin Views**
### Adding Custom Admin Views
This custom admin menu is basically 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 another website or something like that which you can also do. Then I would select an icon. Here is the information. It's the same kind of switches [00:05:17](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m17s) as with adding a back end admin view. You can tweak whether it should be an admin menu or be a dashboard or be a submenu. Then also in which order behind it says 'select before what admin view this one should be placed'. We are placing it before component.
That means it can [00:05:49](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m49s) go at the very top. That is adding a custom admin menu. Because of 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 actually including it as files. [00:06:16](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m16s) There is the compiler(See video). I took all the compiler files and I put it into the folder called compiler. There it is and it's a folder which moves all the files at once. That can also be done, like for example, as you see here 'PHPExcel' which is a folder with a lot of content in it. [00:06:48](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m48s) I put everything I wanted to move inside of this folder and then in my component I simply target that folder and it pulls it in .That's simply shows how a whole lot of folders are added to component builder. When I need a back end admin view custom [00:07:18](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m18s) added, this feature here(Custom Admin Views - add) does that.
**Adding Custom Config Fields**
### Adding Custom Config Fields
A quick overview of the area called config. This area deals with something that is actually quite useful. That is to set up your back end global fields. [00:07:42](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m42s) Let me go to sermon distributor. There we've done some really amazing things.Go to 'Sermon distributor', 'settings' and then 'config'. As you can see it is a very long list of things. If we go to the actual component, let me open it and then I'll click on options. [00:08:25](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) You will see that it has many tabs.
**Custom Switches Using Sermon Component**
### Custom Switches Using Sermon Component
All of these switches are done in the config area, except some of these defaults which is added by the simple switches. For example the global timer, remember 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. Checking in your items automatically. The version control buttons are added automatically as well. Which means the person can set the version control 'on' or 'off'. [00:09:07](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m07s) and the number of records that should be set. If 'zero', then all versions will be saved. This is the version control.
**Adding Contributors**
### Adding Contributors
The author areas is also added automatically. When you click in the 'component' , [00:09:40](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m40s) you will see a 'contributing area'. You can set whether you want to add 'empty contributor fields'. Here(see video) you can add contributors as many as you like, for instance those involved with developing your component and then the amount of empty ones you want to leave there. Its also tweakable. That will basically, add this area here (See video) contributor 1, 2, 3, 4.[00:10:09](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m09s) When you use this switch it controls whether it's been shown in the back or the front of all these kind of features. Which I am not going to go into much depth now. They also are added automatically, as well as the permissional structure .
**Adding UIkit**
### Adding UIkit
In the component you can actually set that it includes UIKit, set it to 'yes'. If you do that it[00:10:37](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m37s) automatically adds this feature to your component and every where UIkit is used. So everything else, this Dropbox, preachers, preacher, categories, category, series list, and series and sermons is all done through that config area here(See video).
**Adding Fields To Custom Config Fields**
### Adding Fields To Custom Config Fields
To add fields to the config area, you first need to add that field to fields. [00:11:07](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m07s) You would go to fields and whatever field you want to use there, you need to create here(Fields). So you first create the fields. Then you need to remember the system name that you're using. Because then when you open up this(add) you would be able to type in the name and it will be selected. And then by convention that tab name 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](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m40s) 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 go and look and see he's using [00:12:00](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m00s) 'Dropbox update method' here. Then you can go look at this file. The 'Dropbox update method', the files, and the text, and even some of this 'Update listing Now!'. If I click it [00:12:23](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m23s) it starts an update. It even shows it here. How to do this is very tricky. It's not that simple to do that because we are not inside of our component, as you can see, we are actually in the config component in the global if you have global settings. This whole feature that is build into sermon distributor. [00:12:56](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m56s) You can look at these things in this list view. All the Dropbox information is there. There is some 'global' like, 'local folder', 'download link'.
**Spacer HR Field In Component Fields**
### Spacer HR Field In Component Fields
Then there is 'spacer hr'. [00:13:24](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m24s) You can see that I have that 'spacer hr' quite often. It's a field that will be included in the paid version of component builder. It already has that 'spacer hr' in it, since you can use the same spacer over and over. The system automatically increment it, it doesn't have conflict in name conventions. I'm just using the same spacer every where. Putting spacers which is this little line [00:14:01](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m01s) you see that line there. It's very small but it gives a space between these areas. That is why I'm doing that. You can also put default values which will be used during installation of the component. If you have switches in your config that you want to populate with default values, you should just add those values here. [00:14:27](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m27s) Then during the install, those values will be added to the database and component builder puts all that in place for you. This(see video) is where you add the config fields.
**Tab - View Names Fields added to Site Menu**
### Tab - View Names Fields added to Site Menu
[00:14:51](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m51s) I added a convention that is not that obvious. If you use a tab name, which is exactly the same as a front end view then it will add this field to that front end views menu.
[00:15:13](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m13s) If you think about Joomla's Content Manager, it 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, then you can overwrite those, you can say use 'global' or you can overwrite them.
@ -53,13 +53,13 @@ That whole system of adding this extra features to every item view of the front
NB. 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 those front end things for you.
**Site View Explanation Of Above Tabs**
### Site View Explanation Of Above Tabs
Here is something about how Joomla API work [00:19:47](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m47s) At the front of this component, if the view , 'Preachers' is opened you will see in the template, there is a extra file called 'Default XML'. Then I'll open that 'default XML'. Now Component Builder adds the convention to this file. [00:20:18](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m18s)
(If you're running into troubles and it's not working as you expected, this is the file in which you can come and look to see what is wrong. That is in the front end. In views. In the specific view that you have, it must be this view, must be the tab name. In that file called 'default XML')(See video). [00:20:41](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m41s)
**Quick Explanation Of Creating Site Views**
### Quick Explanation Of Creating Site Views
This is important since we haven't dealt with adding site views. This site views here, I need to quickly touch on it, that you at least know something that relates to this. That is if you didn't click on 'add' as a menu. If you sets it to 'no' then that file will not exist. That file only exist if this is set to 'yes'. So setting it to 'yes', [00:21:11](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m11s) 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 and make it so that your user can then have unique implementation. This is important. [00:21:34](https://www.youtube.com/watch?v=V2WkTjNFjvo&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m34s) 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.

@ -2,41 +2,41 @@
Hi now next we be looking at the scripts tab. Here is an area where you most probably add a lot of custom scripting. This area is focused on giving you area an interface to add custom scripting to your component in a global way. You can have custom scripting per admin back end view. [00:00:28](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m28s) You can also do that within the global scope with regards to many certain values. The one thing that is nice to have here is, you can add create user helper method to the component.
**Create User Helper Method**
### Create User Helper Method
Now the user helper method is simply code. If you do not know how to write php this method will be of no use to you at all. [00:00:54](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m54s) If you do, then this method will come in very handy. Let me illustrate that to you. If you click this yes, I have a component in which I've already implemented this feature, and it's called the cost-benefit projection tool. If you click on companies, you can actually click 'new'. [00:01:19](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m19s) It has an area for you to create a company.
**Example Helper Method(Create User)**
### Example Helper Method(Create User)
Ideally you would connect that company to a user in the system, if you don't add that company to a user. Because a user can have multiple companies. That's why if you click on this tab(select user), you could select the user. But if you haven't selected a user and you've entered an email address and a name [00:01:49](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m49s) and the needed information, then once you click save, close or save, the system will actually create a user for you. Automatically email the user details to that user. That is because of that specific helper class that I added. Clicking helper class, [00:02:14](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m14s) it doesn't do it on its own you need to write the code for it. Let me show you where I did it in the controller. You have an area if we open up company, you have an area called: PostsaveHook. [00:02:38](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m38s)
Remember when we'd looking at the admin views we could target this area. That's exactly what I did. Let me show you. I'm in the admin view for company. And if I go to PHP you would see that I have some Ajax there. And then I have an area which is the postsavehook method. [00:03:03](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m03s) In the postsavehook method, I'm basically checking some things, some values. When I realized that this user does not exist, if the user does not exist, I'm doing a check here. Then I'm using the create user. [00:03:41](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m41s) I've spoken about this placeholder convention before. Here you are using the brackets convention not the # one. [[[Component]]]Helper and this will be replaced with the components code name. It gets the helper class: create_user. In the helper class of this component, [00:04:13](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m13s) if I close this down, I go to the helper. I open the helper class. That is the name(costbenefitprojection). It is the components name. And then it's called helper. In helper class there is a feature called create_user. [00:04:39](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m39s) It gets an array in it, and that array has some values which we will be using, like password 1, password 2. And it will set the password. I'm not going to explain this code. Basically it just shows you where the function is. The function was added to the components helper class, in that script, I'm simply calling that function after having build the user. I set the array is name and the email is that(validData). The function if there is no password set it will set a random password. Again use another method which also is part of the helper class. We exported it with all helper classes is random [00:05:28](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m28s) method. We can get a random string. That is creating a user and then it sets up the password and then it gets the array ready. It gets a model. The model, I got it from there, getmodel. Again we are using a component builder custom method which gets the specific model from the system. And then fires the register method upon this dataset. And then updates [00:06:11](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m11s) the parameters for the system regarding this new user. Sends the email. And then returns the ID. We are looking for an ID. We want to have the ID. [00:06:41](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m41s) If you don't have the ID, it will send a message to the user. And if we have the ID, it will store it into that database to connect that item to that user automatically and then click save. That is custom scripting. [00:06:59](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m59s)
**Add UiKit**
### Add UiKit
This little switch is just adding that Method to your helper class. That's all it does. Where as this switch adds the Uikit library to your media folder. As well as integrates it dynamically wherever you use [00:07:19](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m19s) the Uikit class names. You won't need to write that in any custom way, it automatically adds it. The same goes with FooTable.
**Add Global CSS To Admin Back End**
### Add Global CSS To Admin Back End
This CSS is global CSS for all the back end views, entire back end. If you want to add CSS that would target the whole back end, then you do it here.
**Add Custom PhP Helper Admin Class**
### Add Custom PhP Helper Admin Class
This is a place for you to add your own custom scripting to the helper_admin Class. [00:07:47](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m47s) As you can see I have a whole custom scripting here for Sermon distributor. For the admin area, as well as an event.
**Add Global Admin Event**
### Add Global Admin Event
I spoke about this event concept briefly before, but what we want to achieve with the event is basically on every page, [00:08:09](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m09s) if you look at this sermon distributor, the back end part of it, it has a file which is the in main file which Joomla calls first. Calls sermon distributor, and in that file it basically triggers that global admin event. The global admin event is nothing else than a function inside of your helper function. So it always triggers it, [00:08:40](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m40s) if you add that switch. Then it passes the document object. The document object is being built up here. I'm just passing it over to the global event. We don't need to clear it there. If I was to open the helper class, which we have here, and scroll to the top, it says here [00:09:08](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m08s) loaddropboxajax. This again it's just another function. I wrote that function that you can add whatever functions you want to run globally every time a page opens. That is a way to run it like a chronicle job on the front and the back end of the component. If you have things that you want to be done chronically, this feature is targeted at doing that. [00:09:35](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) Here we are loading the LoadDropboxAjax. If we go back to the component, you see that I am just adding that script. First I just clicked global admin event yes. And I added that script. That's all they added. And that script was taken and placed inside of the global event. The trigger(globalevent) is set by component builder itself you don't need to write that. [00:10:03](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m03s) It will insert this(globalevent) trigger itself just because you clicked yes. You need to then just add the script that must run inside of the global event. Which I decided to be another function. And then this function which I want to run, I added to the admin view, you see here at the admin helper class. [00:10:29](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m29s) I added that function here. So I basically just used that(loadDropboxAjax) name, and called it "self", because we are inside of that class. That's how you call static class method. And a pass to save information. In my method I'm adding JavaScript to the dorm to the document object. I want that document and then I set addScriptDeclaration. [00:10:59](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m59s) That means on every page of this component in the back end, it adds this little script which then calls by Ajax which I explained previously. And it starts checking the Dropbox listing automatically. So that's an automatic feature I wanted to add to my component. And this is way that I did it. And then I felt that I want to add it that you can do this in other components. That's why I added this event switch.
**Add Custom PhP Helper Site View**
### Add Custom PhP Helper Site View
This same goes for the site area. [00:11:37](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m37s) I also added that same class. You might ask why I have different helper classes for the front and the back. Well it's about security, and permissions. There are things that I wanted to do in the back end, which I'm not asking that much questions. Where on the front I might be more protective. So for that reason and implementation also is often different in the front then in the back. That's why we have two different files. Helpers site class, [00:12:09](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m09s) and the Helper admin class. And you can add custom scripting. I added that same script to the front. And I also added a site event. Which also triggers that same script. Now you might say well if everybody triggers the script, then it's going to be running multiple times. Well [00:12:32](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m32s) that's exactly part of what I did. I actually added a feature in the Ajax call. That logs whether it's already active. And if it's active, it just ignores that call. So Basically it has a controller over whether it should run or not. Meaning that if it needs to run. Because it even has a timer you can set [00:12:56](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m56s) for the sermon distributor. You can set how often you want Dropbox links to be updated. Every day, every 2 days, and so this script. If it checks wants to update and it's not time it just dies, it doesn't do anything. It's very light since it's Ajax. The user himself don't even notice a delay in his page. The page opens as fast as it always do and then fire that Ajax call to the server. Which will starts this whole process on the server. So that's primarily what this is all about. You need to know programming and you need to know how to secure all that. And I'm not going to try explain that to you now. I'm just saying that this is all possible inside of component builder, simply through these custom areas.
**Add MySQL Dump**
### Add MySQL Dump
You can also add a SQL dump. [00:13:50](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m50s) Instead of adding it to the actual views. You can export all the views and add them here(MySQL). It will be actually added to the same file. So don't do it twice. This is another area to add a SQL dump file.
**Dashboard Methods(with example)**
### Dashboard Methods(with example)
Then we have this nice feature called dashboard methods. Let me show you what I've done with it. All this data that I'm showing you is dummy. [00:14:23](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m23s) It is not related to this application but it is just me testing it. I wanted to add this usage statistics to the component, so you could see which country has done what, when in what area. I needed to take a lot of different database tables and calculate, by using certain ways. I wanted to have that on the dashboard. The dashboard already have all these icons. I didn't want it [00:14:53](https://www.youtube.com/watch?v=xY9TWQrF8AQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m53s) to add another custom view, which I could have done, custom admin view. I wanted it simply right there at the moment of the page load. And so we added that feature component builder and we called it dashboard methods. Now let me go to one where I actually implementing it.

@ -1,46 +1,46 @@
# COMPONENT FTP AND MORE
**Adding README Script**
### Adding README Script
Next in the component view we are going to add the README script to a component. The README script is commonly used as the components homepage. If you were to go to Github for example, let's open Github. We are on the demo components page on Github, and you'll see that it has this nice image here, and it has some details and some layout. Now this all is done with the README file. It's with this file here(README). We can open that and then look at the Raw. Here you can see it's basically the same text this we looking at previously. [00:00:53](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m53s) Inside of component builder you can add this README and README text. This is placeholders(###version###).
**Place Holders**
### Place Holders
Now I know that(#) is part of the markdown for a header. You need to know a little bit about markdown. You need to you know what is placeholders and what is not. That is why I added the script so you can get an idea of everything that are placeholders. [00:01:27](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m27s) These placeholders are automatically updated from the details that are in these fields here. You can see the actual placeholders names. It's nice, if you change the version here, it'll updated there automatically. So that is just README file.
**Component-Builder Link Back Info**
### Component-Builder Link Back Info
Really a place for you to give a lot of information to those who are using your [00:02:01](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m01s) application. Maybe you can add some links to it, or you could add some links to help menus, or even instructions on installing it, or anything else that you'd like to share through the README file. I would ask if it's not too much for you to leave this area, this commenting, the more people using component builder, the more involve within a community. Others getting this training set. Help us to sustain this project. If [00:02:36](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m36s) you leave that in, it will certainly be helpful. You are not compulsory, I mean it's only if you want to.
**Markdown Info**
### Markdown Info
Then if you want to know more about markdown, then you can open this link here(Markdown-Cheatsheet). It shows you a little bit of cheat sheet of everything that you can do. That is looking at the README area.
**Admin - Site Views Adding Editing**
### Admin - Site Views Adding Editing
This admin view area, [00:03:06](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m06s) and the site view area, should be seen as a place where you can create new admin views. Do realize that if you create a new admin view it's not necessarily linked to this component. You need to still link it in here, in settings, under admin view. This is more a place to create admin view. If you click on new or to edit existing admin views, that are linked to this component. Same goes with the site views. It's simply a way for you to gain access to editing those site views that already linked to this application easily.
**FTP Info - Updating Component**
### FTP Info - Updating Component
And then the forth. [00:03:51](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s) We want to look at is the FTP server. That FTP server is been added to give you a hand in moving this application, the component to your server and also add the feature of that automated updating that is inside of Joomla. The update server is actually a Joomla concept. If you open a component. I'll open sermon distributor, this is the front I need to look at the back end. We look at the [00:04:39](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m39s) XML file of this component. Component builder built this whole file for you. But at the very bottom you will see that there is an app updates server. That is being added. Now this is not added if you have not set this. If this is set to no, it will not be adding an update server. If you add this(yes) [00:05:03](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m03s) then you can set the link to where the update server is going to be hosted. It will automatically take that link, and added into your XML file, like it's done here. That file itself, Component Builder, can also build that file for you. [00:05:31](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m31s) The way it does it, is this should look like that: host=hostname&PORT=portINT&option(type)=FTP_BINARY. Now this FTP Binary usually is 21. And the default value FTP binary would usually be 15 and then username and a password. [00:06:04](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m04s) Now this FTP details should login directly to this(Update Server) folder that you have up here. All that component builder does, it logs into your server, move this file in there, and then disconnects. And this information is what will make it possible for him to do that.
**FTP Info - Sales Server**
### FTP Info - Sales Server
Same goes with the sales server. The sales server usually would be very much the same concept. You will simply be adding the same kind of string here. Except usually the update server and the sales server is not the same place. [00:06:47](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m47s) The update server, let the user know, that there is an update. Where the sales server, where this component zip file will be stored on your server. You have something like WHMCS or another component through which you are selling your extensions, you can use the folder in your server which it's looking for the files. You can use that folder, you can create a FTP account to that folder, and then set that details in this field here. Then component builder at the moment that you click compile, it has a [00:07:30](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m30s) an option here, it says add backup folder and save sales server. You click that to yes. If you compile it now, it will move the zip file to sales server, as well as creating a backup.
**Component Builder Global Options**
### Component Builder Global Options
The backup and the Git folder is actually set up in your components global options. We haven't really spoken much about the global options. Let us open it now. We saw in this area here, that it says that this field is encrypted. In component builder if you go to global settings, it says encryption settings. In here [00:08:18](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m18s) you would add your own key. By which it will encrypt, once you've added this key. You shouldn't change it because it will not be able to decrypt, because it's used to encrypt and as well to decrypt the data. That just means everything that's been encrypted needs to be redone. In this case it is going to be these login FTP login information. This is the basic encryption which we spoke of on talk about storing types. You got basic encryption and advanced encryption. This is basic encryption way. [00:09:01](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m01s) It's also called basic key.
**Component Builder Folder Paths**
### Component Builder Folder Paths
Then you have folder paths. These two first folder paths, called compiler folder and custom folder, I would leave them for now, they are a little buggy. I haven't fully managed to achieve them being flexible. To move them at this stage is difficult. For a number of reasons I would suggest you just leave them blank. But here you would add a backup folder. This should be related to the root of your server. As well as a Git folder. [00:09:41](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m41s) Git folder would be where component builder creates a folder with all the components files without zipping them. And then you can go to that folder and create a Git create, a Git repository there. From that folder you can push to Github or any other Git server respectively. It's able to create a folder from which you can do Github or any other kind of repository work. Which are separate from your backup folder and also separate from the temporary folder in which [00:10:17](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m17s) compiles the component. You can move it out of your Joomla install. That's what these folder paths are for. So when you do the compiling of the component it does that Git repository. It won't delete the .Gitfolder, it will just replace all the files in it. First remove the old ones then add the new ones and Git will see that only the files that is been changed, it will notice and those who you need to do a recommit, do just a normal commit to get it into your repository. If you don't know Git, then possibly it doesn't make sense to you. There's some great courses as well about Git on lynda.com as well as Udome. You can just go look in at those. That's a backup folder and the sales server. The same goes here with this FTP [00:11:18](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m18s) credentials should be that direct folder in which these zip files should be stored. Unfortunately component builder cannot store it in subfolders at this point. The FTP details will just login to that FTP account, and in that folder which has the access you'll put the file there. No subfolders or other folders, the FTP details should be going directly to the folder. In the component builder, then will be in the back end components, component builder and then Helpers. There is a file called compiler. If you open that file, [00:12:14](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m14s) you would see that we have a function here builtme. Here's all the placeholders that you can use in the builtme file, and will be replaced with the relative information.
**Component Builder Compiler.PhP FTP Info**
### Component Builder Compiler.PhP FTP Info
There is a function here called move file to FTP server. This move file to FTP server, calls another function called: getFTP. Now getFTP is this function here, it takes the signature, checks whether we already made such a connection before. And then loads that object. But here I'm using this parse string function to convert the string into the variables. All the variables in that string is converted to arrays or variables respectively. [00:13:12](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m12s) That then is used to make use of Joomlas own client FTP class. If you want to know where that is, you can in NetBeans you'd click control spacebar. It shows you it's in libraries/Joomla/client/FTP.PHP. You can click there, open it, so we are using Joomlas built-in FTP client, and we passing the host, the port, the option, the username, the password, and making a connection. Then we sending that off to do this move file, which then takes the file content and moves it to the server. That's just for your own piece of mind that the data itself is not being leaked or compromised. [00:14:04](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m04s) It's all handled right here and you can follow its events in component builder, from relations to the update server as well as to the sales server.
**Update Server Extra Info(Versions)**
### Update Server Extra Info(Versions)
The other thing that I know is quite in important. Is this update server, it is an XML file. [00:14:25](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m25s) This XML file is build up of versions and download links to those versions. So like I explain to you in a previous video. There is this reality while you are developing your component. Your users wouldn't need any [00:14:47](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m47s) change updates or anything. The moment you put your component out there on the web. Immediately you need to consider when you make a change in the application, how will you user be able adapt to that change. The biggest changes you can make [00:15:03](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m03s) is adding new views or adding new fields to the component. That makes it a little hard. Like I explain previously, with the history component we've done scripting to take control of that problem. [00:15:21](https://www.youtube.com/watch?v=hzbZlLl-xlA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m21s) You also need to think about the database. We created this thing called: Version Updates. Which gives you the ability to actually add MySQL scripting, which needs to be executed upon the updating.

@ -1,34 +1,34 @@
# DynamicGet
**Sermon - Preacher Get Example**
### Sermon - Preacher Get Example
Hi we still working with sermon distributor. I'm going to use this preacher, which is a get that I already have set up here. I'll use that in our illustration. Here we can see that I have this back end [00:00:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) view selected. So let me select nothing. This is usually how it will look when you start. You'd look select this, (depending on which [00:00:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m39s) area of the back end you want to get the data from) you'd select back end view. Which is the best way to do it.
**Dynamic Get Source Selection**
### Dynamic Get Source Selection
Then there is the Joomla database option. Would gives you the access to draw data from any other component installed that moment in the Joomla Website. [00:01:01](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m01s) If you select your Joomla database, you can select any database that is actually at that stage on your database installed. That means you can reach out to other components through this dynamic get. I'm not going to do that. [00:01:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s) In fact that's also an area which I haven't tested so well. You possibly might try to implement that and ran into some bugs. This stage I can't make any apologies for that since the thing you should do is, instead using back end view option. [00:01:42](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m42s) You might say but why is the other option there? Well it's because that's a feature we certainly want in the application. I'm busy working in that direction, busy programming so did that feature will work without any problems. In fact for the most part if you don't do very complex mapping, if you just do a simple direct database fetch like that(cb_associations), you will be able to use this, it won't give you an issue. [00:02:09](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m09s) What it really is about, is these other linked or joint database structures. That would make it complex. That might cause problems. I'm not 100% sure. Obviously it did work. I haven't tested it well enough as well as I have tested the other part and that is this back-end view. [00:02:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m32s)
There is also the custom option. Where you can just dump the whole option of using component builder to write your PHP for you. Here(custom Get) you can add custom PHP, it will add the methods data for you. This is a custom get option where you write the code [00:02:55](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m55s) by hand. Where as this(Custom - dropdown) option writes the code for you. You'd select the back end view that you want to use. That back end view will be the view that you connected to your component. You need to type your name in here, and then select that package, and it will load [00:03:20](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m20s) all the field names, like a.id, and a.asset, id, and a.name, and allias, and icon.
**Dynamic Get Preacher View**
### Dynamic Get Preacher View
These are all the fields inside of this(Preacher) view. I will load it and I'll put this as asset_id. I would suggest you don't change that. What you can do is you can take out a row. [00:03:50](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m50s) You can remove a row like that, and you can say I don't need that row. I don't need these. Way to there, that's all the data you might want. And then you will know that this would be the variable name of the data on when these get is used. [00:04:13](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m13s) That is the basic part of setting up a Get.
**Get Types - Get Item/List Get Custom**
### Get Types - Get Item/List Get Custom
I need to mention that you have getTypes as well. The getTypes have 4 of them. The getitem which will get one item from this preacher table. Then you got the getlistquery which will get multiple items. [00:04:41](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m41s) Depending on how many items you want to get from the database, you would select either get item or get list. Then you get getcustom, and then you got getcustoms, that plural. The difference between these two or four is the getitem is what you will use only once per [00:05:04](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m04s) view.
If you are building a custom admin view, you will select a main get either, or a getitem or a getlist. You can add multiple getcustom item or getcustoms item. You can see these as other methods that you're adding to the page, but it's not the main method. [00:05:30](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m30s) You have main methods which are these getitem and getlistquery. Which by the way is the exact naming of the methods that will be used. Then you have this getcustom and getcustoms, which is almost same as these two, it's just that they are not main. There will only be another method in the model which will bring data to the view. You can add as many getcustom and getcustoms [00:06:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m00s) methods to your view as you like, but you could only add one getitem, and one getlistquery. Usually the way we would decide on this is that we would say what is the main objective of the view? What is the main dataset that we want to use in the view? That is what we will use in the getlistquery and getitem.[00:06:27](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s)
**Get List Pagination**
### Get List Pagination
If the main purpose of the view show preachers, a list of preachers, I would use the getlistquery as the main selection here. Now you see that you have when you do a listquery, you have the option of adding pagination. That would mean whether the data should only return a certain number. Joomla has a global number. Which you set in the system administrative area under your global settings. [00:07:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m00s) Go to system, then global configuration, then you see there is a default list limit. That is what will be use as the amount that limits the data being returned to the page. It will only return at this stage 20 items. [00:07:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m26s) If I set that pagination to yes. If I set it to no, it will load all the data. Yes would just load some of it, and no will load all of the data. Depends on what you want to do. If you want to do an Ajax, you want to be sure that all the data is being loaded every time. You rather use JavaScript set up pagination for your view, then that is why you would use the no switch most of the time, just say yes. [00:08:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m00s) Component builder will automatically add the pagination code to the page. It will also automatically add pagination code to the model, at the bottom of the page, it will show a 1, 2, 3 pagination. Depending on the template you are using and the styles that are on the page. If bootstrap is not on the page, that 1, 2, 3 might possibly not look right and you will need to add styling to it. [00:08:31](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m31s) Component Builder doesn't know what style is on your page so they cannot make provision for all of that. But it actually can load the pagination itself. it
**Join Data Views - Tables**
### Join Data Views - Tables
Now here you have data and you can join this data to other database tables. Again here like with the main source you're able to select [00:08:57](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) joint views from a table. A view table which is the views of the component or just any database table. To one of the database tables I often connect to categories. Component builder integrates it's application. If you add a category field to any view, [00:09:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m22s) it dynamically set up a category for your component. And integrates the category concept into your component, so it writes all that code for you and the way that Joomla's own applications like article manager does it. It's using the same conventions. If you know how Joomla article manager is bringing categories into the articles, then that is the way your component is going to do it. Here(DB Table - cb_categories) you can select categories. [00:09:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m54s) These switches, I'll deal with them when we come and look in more detail at this area. Then you can model the data there(Selection). Model means decide what you want to return. You don't want to return everything from categories.
**Join View Tables Example**
### Join View Tables Example
But the one I want to look at first is actually this joint view table. We'll come back to the DB option. The joint view Table, let you again select from any of the other views that is part of your component. [00:10:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m25s) Again you can select whether it should return a single row or a list of rows. When you say single row, it means it's going to join it to this other data set that you have as your main data or your main source. It will just be another item in the array. That's why you can't use the name 'Name' for example here. [00:10:51](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m51s) It needs to have that series_ in front of it. So that it doesn't clash with the other data set that possibly also has a value called name. So again if you select anything here(Scaling Factor - dropdown), Series, you will see that it will populate this(Selection) area with all the fields that is in that view. Then this 'AS' button here, [00:11:21](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m21s) you can't use the same alphabetic number twice in the whole query. The whole get function can only use 'a' once and then 'b' once and then 'c' once and then 'd'. [00:11:40](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m40s) We'd made provision up to z z. That is how many tables you can have. Only in this area here(AS).
@ -36,7 +36,7 @@ You would first decide whether this 'Return Row Type', what type of return it wi
But in the system we are working with here, [00:12:56](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m56s) that is not possible you can only connect a sermon to one series. That means it's certainly a single return. Then it will immediately add this series_ in front of everything to insure it doesn't clash with your a table. That's what it's doing. Again you can remove the fields you don't want but please do not edit [00:13:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m18s) the string. It possibly would break. I want it to be possible that you can change this name to anything you like. We are going to try and do that eventually. You can be changing it will still write it this way in the code. That's part of why I'm saying you shouldn't change it not because it will break something, but because it will be ignored and you might expect something else than what it is actually doing. Still it is going to use this implementation, even if you change it. [00:13:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m54s) It will drop the fields you don't select. If you say I don't want these, then it won't get those fields and you will only have this data returned. Again here you can have equal, not equal, equal or not. We also have 'IN' function. That means [00:14:22](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m22s) if this 'On field' is an array, then you can use the 'IN' function to make sure that it actually looks whether the id is in this array. That's the in function. [00:14:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m45s)
**Dynamic Get Preacher In Code**
### Dynamic Get Preacher In Code
This code if we go to the component itself, I'll show you where it writes this code. We're looking into sermon (preacher id). We'll get to why it says preacher id, when we look at the filters and the where. [00:15:06](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m06s) Let's go to the code. You can actually see I'm going to refresh this page, and then go to the code. Since this get is used in the front of the component, we will go to the front end and not to the admin area. We go to the front end of sermon distributor. Then we are looking at the model. The dynamic get is used in the model to get the data. [00:15:33](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m33s) We are looking at sermons. Let me just make sure if that. Yes, it's sermons. It's getting a list query and it's using pagination getting all this. We're looking at sermons. Sermons under the preacher id, it should be this model. [00:16:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m02s) I could get you into the code. You can see the main method which has this id(a.name)or the data set. It is written here(selected area on video). Here you can see id, asset, name, alias, link, types, short description. [00:16:26](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h16m26s)
@ -46,30 +46,30 @@ I just wanted to show how it adds this preacher as well as series to the query.
Possibly when we look at the site layout area as well as the templates, I'll be talking about this transition here again. What you need to know is that this variable, And I'm trying, inside of your layouts and your site views and these things, to give you the correct name. But it is not [00:19:51](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h19m51s) type correctly. Possibly you need to come and check this if it doesn't work. I'll explain that when we get there. We're adding statistics into this(idsermonstatistic) variable through a method which is also on the page and we passing the id of the sermon. If you look at UI, this is exactly what we're saying here. We're saying, get statistics multiple, [00:20:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m19s) join to the left. You can select any of these(dropdown). Then use the main table dot a.id, it must be equal to e.sermon. Then this is the only values I want to return from the e.sermon. The e.sermon is this(see video) value here. I'm saying a.id must equal with e.sermon. [00:20:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m48s) If you look at the code, if we go to this function(idsermonstatisticFcff_E), it takes the id and places it next to e.sermon. Puts into its place. Here's the two arrays. What it is in the database, and what it should be now. It checks whether it executes or checks whether it's got any arrays or any values. [00:21:17](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m17s) Then returns that as an object list, that then gets placed inside of this space inside here.
**Dynamic Get Custom Script**
### Dynamic Get Custom Script
Now you would see this area here(see video) is custom scripting. If we go back to the dynamic get, you will see that there is a custom script area. If you click on it, you'd see that there is different switches. [00:21:54](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m54s) You can select 'getlistquery' or 'before getting the items'and 'after getting the items'. If you select 'after getting the items' and you place any code there, then data gets dumped right after the initial items we've received. It will add that [00:22:14](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m14s) code in there, and then return the items. That is why you can model the data right there in the dynamic get. You going to write the code for the data after it's been get. You can check if I remove this code here, you'd see it tells you that there is an array of items [00:22:33](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m33s) where all values are. Then I'm just saying I want to be sure that those items are set, and that they are there before I start doing it on each of them. Here I'm using the string bracket component helper functions to check whether the string is there. You can dump some nice PHP. Even before getting the item you can add some filters or get list query, [00:23:02](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m02s) if this is model list. If this is item, you'd see that there's a different set of switches is available. It adjusts to the type of query up here. [00:23:19](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m19s)
**Dynamic Get Join DB Tables**
### Dynamic Get Join DB Tables
Coming back to this(Join View Tables) area. Let's again look at the database table option. I selected category and it's a single row that's returned. I called it b. I joined it left, and I set a.catid must be equal to b.id, which is the id of the category. I only want the title and the alias. That is [00:23:44](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m44s) how we set that up. Only the title in the alias and it returns that for us. Then it links it in there(see video), and that's part of what you saw here when you looked at the query option here, it's the sixth section here.
**Dynamic Get Filters - Where - Ordering - Globals**
### Dynamic Get Filters - Where - Ordering - Globals
Now let's look at the filters where we have a filter and an ordering and setting of globals. [00:24:12](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m12s) The setting of globals is if you have a value in this query that you want to use in a custom query, which isn't even setup yet, but you want you know I'm going to need this value in the model. Then you can through this global option here, you can set a global area. Here you should maybe test it. There is an option of using 'This' and 'State'. [00:24:38](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m38s) There is the different of set types. You can set the value to 'State' or you can set the value to 'This'. Here you need to know the key. I want to do the name, in this case is not going to work. Because you got more than one name. Usually this global function only functions well [00:25:01](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m01s) when you are returning a single item. When you do getitem not getlistquery, but you do getitem, then this make sense and then you can give it a name. It will add it to the global scope of the model which you can access through other [00:25:24](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m24s) model methods. which are custom methods. That is setting the global.
The filtering you have a a list of possible filtering. Depending on what you want to do. You might select id, or user, access, level, group, category, [00:25:45](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m45s) tags or date. Some of these are not formulated yet. Like date doesn't work that well yet. Categories does, user, group, access level, user and id does well. This function variable works well. As well as array, value, repeatable value, and other all those already work very well. You can use them and implement them. The only way for you to [00:26:15](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m15s) know exactly how it works you need to know a little PHP, and then you need to compile it and go look in the code what it has done and where it's placed what. That is why I showed you that this is all set in the model. Currently we are saying we wanted to do a JRequest::getint by id. [00:26:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m39s) This is the get area that I added. I look in the code it says 'State Key' and it's this(JRequest::getint by id) here. We set it is a function variable. It doesn't change or adapt this at all. Then says it must be equal to preacher. What we are doing, since component builder doesn't know where the this variable is going to be a string or integer, that's why we have this function which first checks were that is string, [00:27:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m08s) and then checks whether it's a number.
It related and builds up the query respectively. You might feel that is too much and you're possibly right. But that is the only way I am implement it at this stage. Getting more developers involved may possibly improve this long run.
**Dynamic Get Get Access( Default added)**
### Dynamic Get Get Access( Default added)
Then you see the access. We have a bunch of values that fire every time in a custom [00:27:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m39s) dynamic get model. It is the these(see video) values. Often times you might need these values. Instead of you having to do custom scripting to get these values on the page, we add these values dynamically every time. The userid, the group, the authorised group, the access level, the app, and then the input values, which by other URL or post is on the page, [00:28:08](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m08s) and it tells you that it's been initiated, and set it to true. That is if you have custom methods, like this one getpreacher, it checks whether it's been set. If it has been set it doesn't set that again, it can just use it. But if it hasn't been set, it sets it, and also again sets it to true. [00:28:32](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m32s) These global variables can be used inside of the code like the global variable we spoke of earlier. Out of that global variable we are accessing this 'levels', which has the get authorized view levels of the specific user [00:29:00](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m00s) that is now accessed this model or the view that this model belongs to. If he is in these access levels. You remember that public is another access level. If the user isn't signed in, he's a public. This will validate true in the query. We set that up simply by adding access level in a.access. [00:29:28](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m28s) You must check in the main source table for a.access whether the user is in that. That means you don't need to add a state key because the code is done for you. That is some of the filters.
**Dynamic Get Where**
### Dynamic Get Where
Then the where. [00:29:48](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m48s) You can add any table key equals to a certain value. That value could be another table like b.field or it could even be a global variable like we said we could set up. It can also be an id, a userid. The userid is already on the table. It could be like we've done it in this case just an integer which is one. We want to make sure that all the [00:30:18](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m18s) sermons returned is published. If you have an unpublished sermon it shouldn't even return it at all.
**Dynamic Get Ordering**
### Dynamic Get Ordering
That is setting up a getlistquery with pagination through this ordering method we just saying use the a.ordering [00:30:39](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m39s) and send. You can order all the items. Just add many as you like. Be sure that the table that you ordering, could even use a name. It could be a name as an ordering table key. Then you could do a descending or ascending. It would be added to the query. [00:31:03](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m03s) That is also added ordering to the data set from your dynamic get method. Here with the joint view tables you can do very nice dependency calls from other tables in the back end, and bring the data together into one items array. [00:31:25](https://www.youtube.com/watch?v=OPuCoxPW35s&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m25s) That's what dynamic get is for. As you saw we have a main source on the model.

@ -1,43 +1,43 @@
# ADDING DYNAMICGET TO A SITE VIEW
**Checking The Target Dataset**
### Checking The Target Dataset
Hi now that we have the dynamicGet in place, let's add that to a site view and look at the initial implementation. We will go to site view and then click on new, but since we already have that you created, we just going to open it called preacher.
**Populate Fields From Get's**
### Populate Fields From Get's
You would see there on the right-hand there are 3 fields that you can populate with your dynamicget methods. The first one is where you would add all the custom dynamicgets. There you can add multiple custom dynamicgets. The second one is where you add your main dynamicget as we explained in the dynamicget tutorial. you can add 1 main get method per [00:00:57](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m57s) view or site view. Since it's going to be build in the model, either as a getitem or a getitems. It is all depending on the main get whether it's going to be a list or an individual item. Yet you can include custom dynamicgets as many as you like. You also have this data available in your view. These two first fields are used to load the dynamicget to the view.
**Dynamic Values**
### Dynamic Values
The third one [00:01:37](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m37s) is used to display. The possible way that you might want to implement the code of a specific dynamicget option. You'll see that this one displays main gets. This one displays customer gets. This(Dynamic Get) displays both the custom and the main kind of gets. If you select a [00:02:04](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m04s) one of these main gets, sermon(series.id)(getlistquery). You will see that it shows a list printout of the possible ways that you might use the result set. [00:02:32](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m32s) Each of these you can copy by clicking on it. Clicking either right click and copy or you could click on ctrl C and command C to copy respectively the content. Sometimes you might only want to use part of it and not the echo statement included. Then you can click from the area where you want to copy and then before letting go [00:03:05](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m05s) click on control C or command C in a mac to insure you only grab that section of the text. Once you let it go it will select the whole block and then if you copy it, you will copy everything.
**Inserting Values Into View**
### Inserting Values Into View
As you can see we then use this(Dynamic Values) code in the default view to display the data in a PHP [00:03:36](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m36s) fashion. You can also get the customerget here. That one preacher. That value is going to be in this preacher. And if we look here(default view) at the top, that is what we are checking for. Make sure that you have a preacher, and then this block deals with displaying the data related to that information. This one here(see video) [00:04:08](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m08s) checks whether the main items are on the page. Now the main items as you can see is sermons, preacher.id, getlist. If I go down to that sermon preacher, I get list. It shows me that the values are in items. It's an array. I can loop through it and target the the object values. That's what's being done here(default view). We first checking whether it's [00:04:38](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m38s) on the page the values. Then if we see that it is here, we make use of templates to display the various layouts. I will explain in a next tutorial how to use templates in layouts inside of your site view. [00:05:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m01s) This is just quickly showing you how to connect a dynamic get structure or methods to your view.
Then how to make use of the data that are being passed through to the view. This data structures here on the right in red, is the data structure that you can expect from each one of these(Custom Gets). If I was to take number sermons as the method that I want to see, [00:05:36](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m36s) then it shows me that's possibly the way that it will be packed into the data set. It'll be found in this 'numbersermons'. That could change depending on your custom implementation in your components custom coding areas. You might move this data from that position to something else. But the reality is this(Dynamic Values) at least gives you how it would have looked without leaving the [00:06:10](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m10s) normal path.
**Var Dump**
### Var Dump
This is just proposing the dataset structure which ideally would be that you would take this(numbersermon) value here, and do this(see video) in the code. Do a var_dump, and then exit, and then do a build and go look at this view to see exactly the structure. [00:06:45](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m45s) If you are finding that this structure that we've shown isn't working exactly as we expected. Often this helps us to map the array and see where what value is found. Same goes with any of the others. You can just grab that area, that you want to peek into. Put it in var_dump. Do a build, go look at this page in the front of your site. You can see exactly the structure of this object here. [00:07:20](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) Whether it is an array or array with objects or whatever is placed inside of this value set through the dynamic get method.
**Gets In The Code eg: Preacher.php**
### Gets In The Code eg: Preacher.php
Now I just want to quickly peek at the way that these(Custom Gets) methods are actually becoming available in your view by going to the code by looking at some of the implementations that we've done. As you can see we've gone to the front of the site [00:07:55](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m55s) sermon distributor, models. We've open preacher model, use the preacher model. As you scroll down you see that there's a getListquery. This getlistquery gets sermon as the 'a' table, and then [00:08:18](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m18s) series as the 'c' table, preacher is the 'd' and categories as the 'b' table. Then it looks for value in id. Then sets it equal(=) to preacher. Then ensures that [00:08:41](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m41s) the person has access level to the item that's published, and then returns it. That is the getListquery in the model. If we go back to our interface, you will see that we have sermon (preacher.id)(getlist) as the main. [00:09:06](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m06s)
**Looking At The Dynamic Get**
### Looking At The Dynamic Get
I've opened that dynamic get here. And you can see that sermon is set as 'a' the main table. If you open here(Join View Table - Add) you see that series is set as 'c' the only looking for those(selection) values. Preacher is set as 'd', only those(selection) values. Statistics 'e', it's a list. [00:09:36](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m36s) It is multiple. These(preacher, series) that are single are part of the listquery. Where as the multiple of it will have its own method. We will look at that quickly, and then we see in the Join DB table - add that we have category as single, as 'b' those values. Going back to the code. [00:10:01](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m01s) This is the getListquery, in the getitem after we have received the items, we look through them and then in this function here getSermonstatistics and then a generated string(Fcff_E) to ensure no conflicting with other methods on the page. Puts the values in 'id sermonsstatisticsE'. [00:10:30](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m30s) That's where the values are placed. We have a custom method here. Like we shown in the dynamic get you can add custom methods, and returns the items to the page.
**Preacher view.html.php Generated Code**
### Preacher view.html.php Generated Code
In the page you have a file that is called: [00:10:55](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m55s) view.html.php. If you open the file you see that there is a get items method being used to place the items in items. At the moment we are actually in the view at this stage. That means you can access this set of values inside of that class field. [00:11:26](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m26s) If we go back to our Component Builder, you would see if we were to select that(sermon (preacher.id)(getlist)) method, there is the items corresponding to our code. We know that the id. and the asset_id, in all these are in there.
**Checking The Target Datasets**
### Checking The Target Datasets
If you scroll down, you will see that there is a 'idsermonstatisticsE'. So that means in the array there is a [00:12:03](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m03s) key value which has another set of array values in it. You can target these data sets by corresponding pointing values. That is just looking at the main get. If we were to look at the other custom get [00:12:28](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m28s) that is been added. We'll see that here's preacher, which is a custom method that is been added. It also has its set of values and it's database structure and remember we set that we want it to be link to the preachers id. So can I check for the id, [00:12:53](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m53s) and then set it to id, returns to result. Same goes with the number of downloads. It's also custom method that set to this view because of the custom get that was added. Here is the numbersermons. As we go back to our view.html.php file, we see that those values are respectively being added [00:13:21](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m21s) to preacher. number downloads, and number sermons. You can use these values in the view by targeting with this number sermons.
**Site Preacher Tmpl Folder**
### Site Preacher Tmpl Folder
Now the view itself is, as you should know inside of the template folder, under the views preacher. This main view as we call it or the default view, is where that code that we on the page that we looking at [00:13:50](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m50s) being placed. All these others are the templates that are extending the site view. They possibly are extended through layouts that are available in the layouts folder. We are just looking at adding the custom get methods to the page in our next to tutorial. We are going in depth about adding templates to your custom site view, and making use of these data sets. [00:14:24](https://www.youtube.com/watch?v=vEJZe6XqHJE&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m24s) That is how you link them, your first create the custom get, then you come here, you link these. So these are the linking fields and these are just so that you can see the code snippets are making use of these fields respectively. That is custom gets added to site view.

@ -1,32 +1,32 @@
# ADDING TEMPLATES AND LAYOUTS TO A SITE VIEW
**Relationship Between Templates/Layouts In Views**
### Relationship Between Templates/Layouts In Views
Hi now that we've added a dynamic get to a site view, and we have looked at how to access the data sets through the examples snippets. We need to understand how layouts and templates link into site views. Basically to know [00:00:21](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m21s) what is the site view in the code? What is the templates? What is the layout in the code itself? How Joomla load those things?
**Preacher View Example**
### Preacher View Example
If we go to our example, component, sermon [00:00:39](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m39s) distributor, and then view, and preacher, template or Tmpl. You see that there is a default.php file, [00:00:58](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m58s) there is a default_preacherbox.php, default_preacherpanel.php, default_preachersmall.php files. A whole list of them. Those are all templates. The reason why we call them templates, it's because of the method by which they are included into the default file.
**Preacher Site View Example**
### Preacher Site View Example
The Default file is the main file. [00:01:20](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m20s) That's what we call the site view. So everything inside of this file, is actually build in the side view. Let's open the site view. All this code here is in default view. From here to there(see video) is added to that default file. So you see it says default view. [00:01:50](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m50s)
**Location Of Templates**
### Location Of Templates
The way it adds to templates, it's with this snippet that says 'thisloadtemplatepreacherpanel'. You can get these snippets at the bottom of the site view. If you were to scroll down, you first will see the layout snippets and then after them the template snippets. You would scroll down to the one you have [00:02:19](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m19s) made by looking at these names. And then here is preacher, grid, list, table, panel, box, small. That is the snippets that you will use. [00:02:37](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m37s) You might sometimes change the way, possibly stay in the php instead of going out into the HTML. By the way that is what is happening up here if you look at the code. From time to time, I go out of the php(?>), I go into the php, with that tag(<?php), I go out of the php with that(>?). Then I go in again(<?), may go out again(>?), [00:03:04](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m04s) and then I stay out that. I'm basically in HTML. So here is our HTML, and then this part here is 'uikit class' and the implementation. Then I go back into [00:03:20](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m20s) php and I go out again, and here is HTML again. That is a way that you can work with php in the view.
**Default View In Code**
### Default View In Code
If we are going to look at this in the code, and we open that default.php file, you see that exactly what is placed there. So basically we end with php(>?) there [00:03:45](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m45s) Then we go into php(<?) again. Here is the same text that we just looked at in that editor. That text gets placed here and then through these snippets, it includes the template. I'm using a global setting here. I'm checking how this global setting is set in the components global settings. I'm checking what type of display has been set. On the basis of that, I either show this template or that one or that one(see video) [00:04:22](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m22s) in your template view you have access to the same global fields or class fields and public class methods as you have in the default view.
In the default view we have access to 'this preacher' but the same is true of templates. These are the templates that I've just opened. And you see I'm using the same 'this params' here, and 'this preacher' website. I am using the same global class fields or values depends on how you want to call it. That is true of your templates. [00:05:07](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m07s) So If we go back to our interface the way that component builder knows that it needs to add this template to this site view(see video), is simply because of this code snippet. You place code snippet in there, and you'll go look in the template list for a template with this name(loadTemplatepreacherpanel). It will simply add it to that site view. What I mean add, add it to this [00:05:35](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m35s) template in the right folder. You can by doing that, add your templates to the site view. We will look at setting up templates.
**Quick Layout Example Within View**
### Quick Layout Example Within View
We also look at setting up layouts. Layouts work a little different. Let me see do I have a layout here in this site view? It seems I'm mostly using templates, you can use templates and layouts in the site view. [00:06:06](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m06s) I have just used templates mostly it seems. And that means that possibly the layouts I've used in the templates view. If I wanted to add a layout to this view, without doing it inside a template, which doesn't matter, it's just a way of bundling your scripts in a more concise manner, so that he doesn't be overwhelming when you look at the code but that you have it broken up in pieces. The layout structure is mostly used when you are dealing with a part of the display area [00:06:53](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m53s) that is used across other display areas. I usually used the layout structure. At the moment I'm using a piece of code in more than one view or in more than one template. The reality is you could [00:07:12](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m12s) use template inside of templates. You cannot use templates inside of layouts. You can use layouts inside of layouts. These are all conventions that are set forth because of the way Joomla implements the structure. These are not limitations because of component builder. This is just how Joomla does it, it will allow you to add templates to [00:07:44](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m44s) the default site view. It will not allow you to add templates to a layout. It will just scream at you, and why?
**Explanation Templates / Layouts Within Joomla**
### Explanation Templates / Layouts Within Joomla
The easiest way to put this, templates [00:08:02](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m02s) have access to the global values, or the class values. Where as layouts do not. You need to pass layout the value that you want to give it. Now that's important point, because if you look at these snippets, you will see that we're just passing it 'this items'. But you can even pass it just 'this' or you could pass it a specific value. [00:08:29](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m29s) You have your custom classes, you can pass it that specific value from your custom class. It all depends and when you setup the layout. You have an area just like this(see video) where you select the dynamic get that you are using in the layout. Now that is not going to add that dynamic get to your side view or to the model. [00:08:53](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m53s) It just helps you to see the snippets. It helps us to set up the snippet for you. If you've selected the wrong code here in your layout, we'll talk about that again when we get to layouts. It will actually just changed the way it looks here. But you can obviously override it. You can copy this snippet like that. Put it in your code where you want to use it. [00:09:18](https://www.youtube.com/watch?v=6VBbi3Rl2eY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m18s)

@ -1,21 +1,21 @@
# TEMPLATE SETUP
**Creating Templates**
### Creating Templates
In the previous tutorial we where looking at setting up of templates and layout to a site view. Now inside of the side view we see that we are loading preacherpanel, preachersmall, preacherbox. Let's go look at how to create those templates. I'll go to templates, [00:00:27](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m27s) here they are already created.
**New - Copying Templates**
### New - Copying Templates
You can click on new to start with a new template. You could also copy an old one by selecting the template you would like to copy. Click on batch and then there is a copy feature here and click process and it'll copy it for you. [00:00:49](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m49s) Here I have preacher panel open. In preacher panel it's the same concept it's an HTML area. If I want to use php I need to go into the php. Then I can go out again. I can also add this text placeholders, which helps us to ensure the text itself is translatable. You can just do your normal English text like that 'sermon count', and [00:01:16](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m16s) 'total downloads'.
**Language String**
### Language String
Component Builder will add these strings to the language file for you. You don't need to be concerned. At this stage it only does your British English language file. If you need to add more languages, you need to look up the documentation of adding languages to a third-party extension, [00:01:44](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m44s) and do that same implementation. Here(Layouts Code Snippets) we see that you can add layouts to this template by using any of the snippets to this template. You can add other templates to it. You can use templates inside of templates. You could have use layouts as well so more or less the same behavior as in site view.
**Adding Custom Script/Code to Template**
### Adding Custom Script/Code to Template
You also have your snippet box, [00:02:15](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m15s) which you can make use of adding script quickly to your page. We see that the script that I just looked at in the preacher panel, if we go to the code, preacher panel, it is exactly the same script that you seeing here(code). [00:02:46](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m46s)
**Adding JavaScript To Template**
### Adding JavaScript To Template
There are a few exciting points here. One of them is a side note in your details tab, in the template area here at the bottom. You can add JavaScript with your normal script tags. You can just add your JavaScript in there. [00:03:13](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m13s) It will work and be loaded into the page through this little snippet. That's a nice thing to know. You still have access as I said before to all the global 'this' field values, like you can see there. [00:03:35](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m35s) You can access those quite easily. That is how to set up a template, is the same kind of conventions as setting up a site view. Except that this is not the main view, it is a template used somewhere in a main view through adding this code snippet with Joomla class get template method. [00:04:02](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m02s) Then basically load template as the method that is being used with that name. Then it adds it to your component site view as well as adds the code to it and everything else. That is a template. next up we will look at a layout. [00:04:29](https://www.youtube.com/watch?v=khxKeeubhiY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m29s) It really get excited there.

@ -1,50 +1,50 @@
# LAYOUT SETUP
**Layouts**
### Layouts
We going to look at setting up layouts. We setting up layouts you have some nice ways to reuse code across multiple templates or site views. One of the things that I found is that I would like to know which side view is actually calling the layout. So that all the bases of that I could use global settings that are related to that specific site view. [00:00:31](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m31s)
**How Layouts Work With Dynamic Gets**
### How Layouts Work With Dynamic Gets
What I've done, in the dynamic get I've added a little string. Since each dynamic get targets only a specific site view. If I was to open sermon (preacher.id) which is primarily going to be used in preacher side view. If I look at the custom script, you will see that I added a view key called preacher. By doing that I know since this dynamic get [00:00:59](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m59s) is only used in the preacher view, that when the layout is called and I'm in my component, I'm only passing the item. So not the whole list of items, but just one item to the layout that helps me to know. This specific item is calling from preacher, and I can on that basis do certain implementation [00:01:24](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m24s) to ensure that the layout displays in the way I expected. That's just a little heads up on making your layouts even more dynamic then going to the template.
**How Templates Call Layouts**
### How Templates Call Layouts
We will open your template that calls the layout. We want to see that initial setup and one of the templates that really illustrates this very well [00:01:54](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m54s) is this sermon list. So I'm going to open sermon list. In sermon list you see that I'm looping through the items. Then I am adding some parameters to the item object. One of them is the params, the other is I'm taking the description and making sure that it's escaped, and it is no longer than 90 characters. [00:02:26](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m26s) Then I'm adding that back to the description without the full name, and then adding that item to the 'JlayoutHelper::render(study class render)(sermonlist item)' [00:02:46](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m46s) as the layout name, and that basically is going to populate the script between the list items that is going to be placed in an unordered list on the sermon list page.
**Sermon List - Item Layout**
### Sermon List - Item Layout
Now let's go look at this specific layout 'JlayoutHelper::render(study class render)(sermonlist item)'. [00:03:15](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m15s)
In layouts look for sermon list item. In sermon list item you will see that I'm using that global, the item that is being passed is placed inside of displayed data. Display data is basically the item object. [00:03:43](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m43s) Since I placed the parameters in it, I can use the get method with the specific global field name, which is set in the components global settings.
**Using The View Key**
### Using The View Key
Since I'm targeting a specific view, [00:04:02](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m02s) I'm using the view key, adding it to the string and checking what is the value for this specific view in the global of the component. On the basis of this I'm actually able to make this view very dynamic, and can use it through multiple layouts, based on that view key. I know if others want to use the layout in their components extending this one it possibly will not work that well. [00:04:31](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m31s) But since we are using it for our own component and really for our own implementation, I don't think that's too big a deal. At the same token I am able to check. Simply what is the view key? Is it preacher, series, or category? On a basis of that I ask different questions and have different implementation of certain values like series name, preacher name, and category.
**Layout To Template Custom Scripting**
### Layout To Template Custom Scripting
There is another convention that I think is very worthwhile mentioning here, and that is the convention of actually [00:05:11](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m11s) in the template, we go back here(editing the template). We go to custom scripting. There is the [[[sview]]] placeholder. The [[[sview]]] placeholder will be replaced with the actual views name. Since we using a template here, you see this is a template. [00:05:32](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m32s) This sermon list, that one, I'm adding that template to multiple site views. I'm not just adding it to one site view, I'm adding it to multiple site views.
**Dynamic Custom Views using Template**
### Dynamic Custom Views using Template
Since I want this template again to be dynamic, so wherever I add it, I want it to dynamically add to that site views name. [00:05:57](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m57s) Then as you can see I'm actually asking the global parameters for that site view sermon list style. That means it is going to add for example preacher there, or it's going to add series there, or it is going to add category there. It will say category, sermons, list, style.
**Above In The Code**
### Above In The Code
Let me show you that in the code. I have category open, I've got preacher open, as well as series. [00:06:30](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m30s) You can see that I'm adding sermon-grid, sermon-list, sermon-table to them all. If I was to open sermon-list in series, you will see that name was changed to series. If I was going to open sermon-list in preacher, [00:06:53](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m53s) you will see it was changed preacher. If I open it in category, you will see that it added category. That means that our little place holder was dynamically updated by component builder on the build, then it behaves as you expect.
**Config.xml**
### Config.xml
Now you would know where is it getting these values? [00:07:20](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m20s) If we go to the component in the back end, a we can open it's config file. Scroll down. We get an area called 'preacher_custom_config' which is a tab, and the tab's name is preacher. In this tab we have these: value_preacher_display, [00:07:48](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m48s) preacher_box_contrast, preacher_list_style. We scroll down, we see preachers_sermon_count, preacher_email, preacher_website, and then preacher_sermon_display, and preacher_sermon_list_display. Now if we take that sermon_list_display, and search for it across the file, say I make it [00:08:13](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m13s) cap sensitive, we see that it has 6 matches. That means there is 6 places, actually 3. Because one of the other 6 are in the comments, one is category one is series and one is preacher. [00:08:33](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m33s) Those are the three different views. Let make use of that series list style. Now the series list style is then being implemented on the basis of that dynamic updating of the string here. It's simply getting the style. Then doing a switch when setting it accordingly. that is another nice [00:08:57](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m57s) to have tool. To again make a template more dynamic. You can build a template and you can reuse it in multiple site views. Simply with this place holders which is called site view. I should have mentioned that in the templates explanation, but since we only came across it now I mentioning it here.
**Layout Concept**
### Layout Concept
Going back to the layouts. Your layout [00:09:27](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m27s) concept is more or less the same as templates. It has a layout area in which you put your script and here you can see we are using that(see video) key replacing. You can see that if you select certain dynamic gets, we are take the liberty of showing you that we are starting with display data. But this snippets here(see video), might not correspond what you're doing because you can really pass anything to a layout. We are just assuming that if you're using that dynamic get, you possibly passing it in this [00:10:06](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m06s) way or that way. You can't just copy and paste this necessarily. At least you can know when you look at a specific dynamic get here, what are the values in it? And how you can try figure out which ones to use here. This again will be only really something you need to use if or can use if you are actually aware of our php and everything will [00:10:34](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m34s) do the implementations here. And if you're not familiar, you don't need layouts. I mean you can build your whole front end right in your site view. It might be a long lengthy script, but it still work. The reason we added layouts and templates is simply for our own convenience. If it's little confusing to you, you can skip this whole area for the meantime.
**Layout Custom Script Area**
### Layout Custom Script Area
Begin at layouts you have the same concept of adding custom scripting. Which will be placed in the head of the file. Remember that your global data or the data being passed is in [00:11:14](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m14s) display data. Here again you have your html area. But you can jump into php and check some values and on the basis of that, do your certain implementations. That is really setting up a layout.
**A Note: Use Layout in a Layout**
### A Note: Use Layout in a Layout
Just another note you can actually use a layout in a layout. You can pass values, any value you like. [00:11:42](https://www.youtube.com/watch?v=52OLSZio0F8&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m42s) I realized that 'this' here is maybe not that appropriate. You need to keep a heads up for that. This doesn't exist on the layout page. You need to use the display data as the global or as the main object from which to start your implementation.

@ -2,26 +2,26 @@
We need to have a quick look at custom admin views. They do have some nice ways of doing things very similar to site views. Some aspects and adding it to component builder is different. In the next video we will look at adding site views as well as component custom admin views to the component. The reason I didn't speak much about the custom admin views is simply because sermon distributor is not [00:00:33](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m33s) using custom admin views yet.
**Example View From Other Component**
### Example View From Other Component
I have another component I can use as a example called: Cost Benefit Projection. It's a tool that is used to show companies the cost benefits of intervening on certain diseases and causes in the company. [00:01:04](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m04s) In it we have what we call company results, and combined results, respectively used to display custom data in the back end of the component to certain different people who has permission to view those data. In the component itself, if we click on companies, you would see there is an icon underneath each of these [00:01:36](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m36s) names of the companies. There is a new button in the top called combine results. These buttons are dynamically added by component builder. In the next tutorial I'll show you exactly how that is done.
**Component Builder Custom Admin View From Above**
### Component Builder Custom Admin View From Above
What I want to show you here is simply how a custom admin view will look. I'm going to click on one, this is all dumb information, [00:02:07](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m07s) let's open ClientM. You have this big area where you could put a lot of html and php. You have some custom buttons that you can add. I will show you that. All of this in the white area is simply done in the custom view. If I was to click around I've got a menu here at the side. All of this is done inside of the custom area [00:02:44](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m44s) of the component. Which is now the custom admin view. That is how it will look. It has different value sets, and you can from here add an edit button. Since we've linked it to a specific client or company or one item in that list, [00:03:10](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m10s) we can click on edit. From here we go right into the companies data and edit it. What is nice if we were to click close here, it take us back to that exact result page. You can then go and look at the implementation what you've done. [00:03:35](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m35s) That is just simply showing you how a custom admin view could look. Let's go back to the companies list or we could go back to dashboard. Look at component builder, we looked at company results and we open it. Here is all php and html on my page doing all the work. As you might expect I'm loading [00:04:05](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m05s) templates directly from here.
**Add Custom Button Sample**
### Add Custom Button Sample
Then I have a custom button area where I can say yes. I want to add custom buttons. Then I click on custom buttons(add). You will see I have 'icons' that I can select, and [00:04:25](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m25s) the 'name' of the button, and 'controller method' which I would like to use, to make the button work. In this one(target controller method) I'm saying 'gotocompanies'. This one is 'editcompany'. Here I should say what kind of target are we looking at? Is this a single, a list, or both? [00:04:52](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m52s) You can set that respectively, and then you click save. It only saves it to the form, and not to the database. We should have made that done, but this is the Joomla's way of implementing it.
**Adding Script For The Controller Methods**
### Adding Script For The Controller Methods
Now you have to add in the php controller method, add scripting to respectively implement the buttons click method. [00:05:16](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m16s) You can also do that to the model. So in the controller you can add script, and then in the model add scripting which is called from the controller, if you want to separate your code a bit. If you're not going to be adding any script to the model, just add none with this two spaces// in front, otherwise it might scream at you that you did not add script there. As you can see the 'gotocompanies' is simply [00:05:47](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m47s) take you back to the companies view. Where as the 'editcompany' implements the Joomla's convention of opening an item to edit it by the correct channels. This is just Joomla knowledge at work here. And we are checking a token and all that. Component Builders sets of all the tokens and everything. [00:06:13](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m13s) This(see video) snippet you can reuse for your purposes if you want.
**Area For Custom Scripting**
### Area For Custom Scripting
We have an area for custom scripting and as you can expect. There's a lot of custom scripting going on in that view. It has its respective places, if you want to know where, what's happening at some snippet here, compile your components, search for that snippet, and you'll see where this comes up, if you're not certain by the naming conventions we have used. That is how you setup custom admin view. [00:06:51](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m51s)
**Combining Multiple Data Example**
### Combining Multiple Data Example
To look at the other one, the combined results view. The combined results is this one up here, if you click it, It will tell you, we need to have some items selected. You select the items and click combined result again, and it will do a combined resolve taking both companies adding it's data together, [00:07:16](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m16s) and giving you a nice layout structure of it's data sets. That is the combined concept. If we go back to the implementation of it, it looks very similar as the other. Again just a lot of html and php here. Also some custom button, again just going back to companies. [00:07:41](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m41s) It's just same implementation, vcard companies, go back, single, and then some custom scripting. That's how I set up both of those custom views. Quite simply adding the data. Then making use of the templates as well as layout implementation in both of these. You can set up layouts and templates and use them in site views, you can also use them in admin views. [00:08:11](https://www.youtube.com/watch?v=gtdQ1lwB9ds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m11s) In our next tutorial we will look at how to add site views and admin views to your component since there are some differences and you need to be aware of them.

@ -1,18 +1,18 @@
# ADDING SITE VIEWS TO A COMPONENT
* **Using Sermon Distributor As Example**
* Using Sermon Distributor As Example
Now let's look at adding admin views and site views to component builders component. Looking at all the different switches and the nice features that we have there installed for you. We first login. Then we have component builder open, under component builder. Then we will go to [00:00:25](https://www.youtube.com/watch?v=zZ_HJeYL8ps&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m25s) components.
**Settings - Views**
### Settings - Views
We will open Sermon Distributor and then go to settings. In settings you see there is a place for admin views. We have already illustrated adding the admin views. There's custom admin views and there is site views. I'll click on add custom admin view. There isn't any added to the component,[00:01:01](https://www.youtube.com/watch?v=zZ_HJeYL8ps&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m01s) sermon distributor does not have custom admin views. I'll illustrate it in another component for you.
****Adding Site Views Important _Glitch_** **
### Adding Site Views Important _Glitch_
Then site views. It has quite a few. You might sometimes open it and see, that some of the buttons are not selected. Although you selected it previously and save it and it doesn't show. This is a glitch [00:01:25](https://www.youtube.com/watch?v=zZ_HJeYL8ps&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m25s) in the Joomla's own JavaScript or whatever that is causing this. The only way I have found to solve it as yet is to simply re-open, like for now(you will see admin view has the same issue) if you close it and open it again, it has it all selected. This is a heads up. Keep a look out for this, because if you make changes and save it with those buttons anticked, your build will [00:01:56](https://www.youtube.com/watch?v=zZ_HJeYL8ps&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m56s) not include those values since it will be stored as null. You might get unexpected results. Always make sure that your old ticks are all in place, that just a heads up. It is not something I can change at this stage. It is a Joomla thing of the repeatable fields.
**Site View Options(Menu-Metadata-Default View-Access)**
### Site View Options(Menu-Metadata-Default View-Access)
If we go to site view [00:02:21](https://www.youtube.com/watch?v=zZ_HJeYL8ps&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m21s) and we close it again and open it again. You will see everything is selected. You will see that it has 1,2,3,4 options. You select the site views, add as many as you like.

@ -1,38 +1,38 @@
# ADDING CUSTOM ADMIN VIEWS TO A COMPONENT
* **Example Component Not Sermon Distributor**
* 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.
**Settings - Custom Admin View**
### Settings - Custom Admin View
And then we go to settings. And then we'll go to custom admin views. [00:00:20](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m20s) We will see there is two custom admin views added.
**Multiple Switches Due To Being Dynamic**
### Multiple Switches Due To Being Dynamic
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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m45s) of the page. Then you can decide where this should show in the main menu. Select if you should show in the main menu.
**Icon - Main Menu - Dashboard - Submenu**
### Icon - Main Menu - Dashboard - Submenu
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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m14s) which you will see when you are in a view. So these are all placements where you can possibly add this custom view.
**Targeting Item(some switches are no)**
### Targeting Item(some switches are no)
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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m41s) That means we are targeting an item in a view.
**Select Target View**
### Select Target 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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m02s) to ensure that it targets the correct view, is simply by selecting company here.
**Showing Within The Component**
### Showing Within The Component
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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m27s) 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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m55s) 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](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m25s) list of records to yes, and has metadata, and has access, and also company.
**Order Before Selection**
### Order Before Selection
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
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.

File diff suppressed because one or more lines are too long