Updated 044 Hello World Component with Joomla Component Builder Creator Extended (markdown)

Amigo 2019-08-23 08:29:21 +02:00
parent e8744753a2
commit 5cfa04fd51

@ -447,10 +447,18 @@ An 'href' is set up around this name but use PHP to take care of creating a link
[01:23:56](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h23m56s)
Let's create that display Site View. So the 'var_dump' is removed from this view. Save and close. I could have set save a new. I'm going to create another Site View and call it 'Greet'. It can not be called 'greeting' because there is already a 'greeting' in the front. 'Greeted' may be better. By using the Panel a nice display can be made. [01:24:40](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h24m40s) Copy the Panel Snippet and paste it in Default View. Make the title 'name'. The content will be the greeting. Two of those are not necessary, so one can be removed. [01:25:08](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m08s) One greeting is set up and there are no buttons here yet to edit it but we will view one Greeting. It will also show you who set up the greeting. Close this. We got this Greeted Site View and can go to the Admin area of the Joomla Component area. [01:25:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m36s) Click on Edit and add a Site View to the Component the same way we did before and say I want 'Greeted'. I do not want it to have an Add Menu. It must have 'Has Metadata'. [01:25:59](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m59s) It is not a Default View. I also want Access there. By Default it is not Public. Save and close. Compile the Component again and install it.
Let's create that display Site View. So the 'var_dump' is removed from this view. Save and close. I could have set save a new. I'm going to create another Site View and call it 'Greet'. It can not be called 'greeting' because there is already a 'greeting' in the front. 'Greeted' may be better. By using the Panel a nice display can be made. [01:24:40](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h24m40s) Copy the Panel Snippet and paste it in Default View. Make the title 'name'. The content will be the 'greeting'. Two of those are not necessary, so one can be removed. [01:25:08](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m08s) One greeting is set up and there are no buttons here yet to edit it but we will view one Greeting. It will also show you who set up the greeting. Close this. We got this Greeted Site View and can go to the Admin area of the Joomla Component area. [01:25:36](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m36s) Click on Edit and add a Site View to the Component the same way we did before and say I want 'Greeted'. I do not want it to have an Add Menu. It must have 'Has Metadata'. [01:25:59](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h25m59s) It is not a Default View. I also want Access there. By default, it is not Public. Save and close. Compile the Component again and install it.
[01:26:24](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h26m24s)
If we go back to this file 'Hello_worldHelperRoute', scroll down and see that it now has a methods called, 'greetedRoute'. Pass it and the ID and it will constructs the URL. This Component view does not have 'Category' so it will skip this area. But it is a function that should be able to work for any view. [01:26:54](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h26m54s) If you want to use this method and this abstract class. Those of you that are [01:27:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h27m11s) a little bit interested in how this works, you'll see in the Main File of the Site View, you'll see that the route is also added as a helper class. This is the name of this helper class. 'Hello_worldHelper' Route. That's the abstract class name. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If we go back to this file 'Hello_worldHelperRoute', scroll down and see that it now has a method called, 'greetedRoute'. Pass it and the ID and it will construct the URL. This Component view does not have 'Category' so it will skip this area. But it is a function that should be able to work for any view. [01:26:54](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h26m54s) If you want to use this method and this abstract class. Those of you that are [01:27:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h27m11s) a little bit interested in how this works, you'll see in the Main File of the Site View, you'll see that the route is also added as a helper class. This is the name of this helper class. 'Hello_worldHelper' Route. That's the abstract class name.
### Back To Site View To Add Link
[01:27:39](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h27m39s)
Return to the Site View of Greetings to add the link. Get the method name. Then go back, scroll down to, 'getGreetedRoute' which is the method name and copy it. [01:28:05](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h28m05s) It must correspond to the view that we want to open. It is going to be a '$item->slug'. That is not the only function that is going to be called but also the JRoute class. [01:28:40](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h28m40s) We would add the JRoute around this first method class and that would add the other values to the URL that is required.[01:29:01](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m01s) We have our helper class of the Component and then give it a slug which gives it to the JRouter and then echos out the link to open this item. [01:29:20](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m20s) Save this and compile it again. To see it in action, go to the front and reload the page. If one of these names is clicked; James, William, Sara, and Koos it indicates that it is not authorized to view Greeted. That means a specific group is not allowed to look at Greeted. There are ways to prevent the link from showing up in the first place. [01:29:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m51s) But this is because of, that for some reason you did not put that custom script into place.<<<<<<<<<<
@ -458,12 +466,6 @@ If we go back to this file 'Hello_worldHelperRoute', scroll down and see that it
### Back To Site View To Add Link
[01:27:39](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h27m39s)
Going back to our Site View of Greetings to add our link. Let's get the method name. We go back, scroll down, getGreetedRoute is the method name. We can [01:28:05](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h28m05s) copy it. It needs to be corresponding to the view we want to open. It's going to be a ($item->slug). That's not the only function that we want to call here. There is another one I mentioned [01:28:40](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h28m40s) which works alongside this and it's called the JRoute class. We would add the JRoute around this first method class and that would add the other values to the URL [01:29:01](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m01s) that is required. We've got our own helper class of a Component. We give it a slug which then gives it to the JRouter and then echos out the link to open this item. [01:29:20](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m20s) Let's save this and compile again. To see it in action we go to the front and reload the page. When we click on one of these James, William, Sara, Koos it says not authorized to view Greeted. That means this specific group are not allowed to look at this. There are ways to prevent the link from showing up in the first place. [01:29:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m51s) But this is for some reason you didn't put that custom script in to place.
### See How Back end Generates In The Code
[01:29:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m58s)