From f5442f5279819a5c928431af29ddc098ed1958be Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Fri, 23 Aug 2019 10:01:43 +0200 Subject: [PATCH] Updated 044 Hello World Component with Joomla Component Builder Creator Extended (markdown) --- ...omla-Component-Builder-Creator-Extended.md | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/044-Hello-World-Component-with-Joomla-Component-Builder-Creator-Extended.md b/044-Hello-World-Component-with-Joomla-Component-Builder-Creator-Extended.md index 7ea2f0b..484da21 100644 --- a/044-Hello-World-Component-with-Joomla-Component-Builder-Creator-Extended.md +++ b/044-Hello-World-Component-with-Joomla-Component-Builder-Creator-Extended.md @@ -455,34 +455,31 @@ If we go back to this file 'Hello_worldHelperRoute', scroll down and see that it [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.<<<<<<<<<< - - - - - - - - - +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. ### See How Back end Generates In The Code [01:29:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h29m58s) -You can see how the back end generates some of this. If I go into the code and we go to the administrator area of the hello world component and we open views and then greetings and we open the default_body.php and we open the view.html.php. You'll see that it is grabbing some permissions to know whether it should show certain buttons. And then in default_body.php again is setting up some permissions to see whether [01:30:48](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h30m48s) you are allowed to edit the greeting. If you're not allowed to edit it, it just echoes the name. You see it doesn't show you the link. So this area here(see video) is a demonstration of what you want to do in the front. [01:31:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h31m11s) You don't want it to always show the link to the item unless the person who is viewing the site, is in the correct group of the site to be able to view the item. I'm not going to spend more time on this part because we want to also do an editing concept [01:31:31](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h31m31s) which is really more interesting and what I would rather spend time on. I'm just going to go back into the admin view in the admin area and just change the permissions that the actual public could still open this view for now. In the back end I go to Options of the Hello World Component Permissions, scroll down. Again I'll see there is a new one called Greeted (site) Access, [01:31:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h31m58s) change this to Allowed for the Public group. Save and close out of there. +You can see how the back end generates some of this. If we go into the code and go to the administrator area of the Hello World Component and open 'views' and then 'greetings' and we open the 'default_body.php' and we open the 'view.html.php'. It is seen that it is grabbing some permissions to know whether it should show certain buttons. In 'default_body.php' again is setting up some permissions to see whether you are allowed to edit the greeting. [01:30:48](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h30m48s) If not, it just echoes the name. The link is not shown. So this area here(see video) is a demonstration of what you want to do in the front. [01:31:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h31m11s) You do not want it to always show the link to the item unless the person who is viewing the site, is in the correct group of the site to be able to view the item. [01:31:31](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h31m31s) -### Quick Demonstration To Setup A Front-End +Go back into the Admin View in the Admin area and change the permissions that the actual public could still open this view for now. In the back end, go to Options of the Hello World Component Permissions, scroll down. Again there is a new one called 'Greeted' (site) Access, change this to 'Allowed' for the Public group. Save and close. + +### Demonstration To Setup A Front-End [01:32:05](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h32m05s) -If I go back to the front and click on this link James, it opens it and it gives us the name James. It gives us the Welcome to JCB and the greetings were set by Super user. It loads it as we expected. You can also see in the URL this demo site of mine isn't fully search engine friendly setup, but it already generates that this is a greet to James. And so And the name James appears here because of the slug. The slug is used to generate the search engine optimization here. If we didn't have an alias it would have given you one or two depending on the item ID. [01:32:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h32m58s) That just gives you a quick demonstration of how to setup a front-end that can open specific items. +Return to the front and click on this link 'James', it opens and gives us the name 'James'. It gives us the Welcome to JCB and the greetings were set by Superuser. It loads it as expected. You can see in the URL that this demo site of mine is not a full search engine friendly setup, but it already generates that this is a 'greet' to James. The name James appears here because of the slug. The slug is used to generate the search engine optimization. If we did not have an alias it would have given one or two depending on the item ID. [01:32:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h32m58s) That is how to set up a front-end that can open specific items. ### Next Step: To Make Items Editable [01:33:07](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h33m07s) -The next step is to make these items editable. Like I explain to you in the admin area we're already doing some of this. I'm going to just copy and paste most of the code from the admin area. I would encourage you to do the same unless you know enough that you can just do it without looking at how JCB did it. I'm going to copy the string(see video) and then I'm going to also copy these few lines. I'm also going to use some of these(see video). +The next step is to make these items editable. I am going to copy and paste most of the code from the Admin area and to copy the string(see video) as well as these few lines and use some of these(see video).<<<<<<<<<< + + + + ### Checkout Value Needs To Be Set On Page