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

Amigo 2019-08-22 08:28:02 +02:00
parent 3b3a2e0887
commit bd1eff83a1

@ -412,11 +412,13 @@ The manual way to do this is to go to the Hello World Component, click and on 'O
[01:13:00](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m00s)
Add a link to James so that when you click it, will see the Greeting that James should receive. Go back to the Site Views and open the Greetings. Now we want to add a link. But there is a better way of doing a link in JCB which take care of all the controller issues. [01:13:27](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m27s) In the front end of the Component the models for greetings.php can be opened, there is the getItems method. In it may be checked whether this item has an alias. If it does have an ($item->id) and an ($item->id), it creates what is known as a '$item->slug'. This ($item->alias) and ($item->id) is combined into the '$item->slug'. [01:13:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h13m58s) Since our greetings area does not have an alias but only has an ID. It will only end up with an ID in the slug.
### Adding An Alias
[01:14:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m11s)
Add an alias to the Greeting. There is a shortcut to the Fields linked to an Admin area. It is this little icon below Greetings. We want to add another Field called Alias. In Fields there is already a Field called Alias, simply use that Field. Go back to the Admin Views and click on this shortcut icon below Greetings to add fields. [01:14:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m52s) Click the green plus button and add an Alias. Now (alignment) both of these Above Tabs are moved. An Alias is created in the second line. In Greetings, make it full-width Alignment. [01:15:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m18s) The Greetings will also be edited so that it is no longer a text field but a text area. With all in its place, Save and Close. Open the Greetings in Fields. Since there are some values that I want to stay the same, I am going to select the XML Definition and copy it.[01:15:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m51s) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Add an alias to the Greeting. There is a shortcut to the Fields linked to an Admin area. It is this little icon below Greetings. We want to add another Field called Alias. In Fields there is already a Field called Alias, simply use that Field. Go back to the Admin Views and click on this shortcut icon below Greetings to add fields. [01:14:52](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m52s) Click the green plus button and add an Alias. Now (alignment) both of these Above Tabs are moved. An Alias is created in the second line. In Greetings, make it full-width Alignment. [01:15:18](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m18s) The Greetings will also be edited so that it is no longer a text field but a text area. With all in its place, Save and Close. Open the Greetings in Fields. Since there are some values that I want to stay the same, I am going to select the XML Definition and copy it. [01:15:51](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m51s)
Then select 'Textarea' and paste that first XML in here, only in order to remove it again since it is just to copy and paste. [01:16:13](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m13s) Cut the name. I want to keep the same name. You can not change the Type because the Type at the top of the page needs to correspond with the Type in the XML. Changing the type in the XML will not work. Keep the Label the same. We want to add 'greetings' as a description. We do not want to default text. [01:16:57](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) Add the hint back again. We do not need any of these other fields, just remove them and do not want the filter to be set to 'raw'. We would rather use the word string since we do not want any HTML at this stage in our greetings. If you want HTML now in the greeting you can use the Save HTML. It is not in this list but it does exist. Usually, we would use the editor instead of just a 'textarea'. [01:17:43](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m43s) The 'textarea' is in place and I am going to add 'class.'text_area span 12'. It is not certain how long that will be there as a class. Save and close. [01:18:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m11s) Since not any of the Database values with this text field had changed, there should not be any issues. But a new text field had been added. If the Component gets compiled in the Compiler, it may be seen that it dynamically incremented the version 2_0_1. If we go to the Component without installing, you will see that it has not updated the view because this was open. Before doing anything I would suggest that the view should be reopened and the page refreshed so that the changes can show.<<<<<<<
@ -424,13 +426,18 @@ Add an alias to the Greeting. There is a shortcut to the Fields linked to an Adm
Then I'm going to select Textarea. I'm going to paste that first XML in here. We have to remove it again but just so I can copy, paste. [01:16:13](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m13s) Cut the name. I want to keep the same name. You can't change the type because the Type up at the top of the page needs to correspond with the type in the XML. Changing the type in the XML will not work. The label you want to keep that the same. We want to add greetings as a description. We don't want to default text. [01:16:57](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) Let's add the hint back again. We don't need any of these other fields, so we can just remove them. We don't want the filter to be set to raw. We would rather use the word string. Since we don't want any HTML at this stage in our greetings. If you want HTML now in the greeting you can use the Save HTML. I see it's not in this list but it does exist. Usually, we would use the editor instead of just a textarea. [01:17:43](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m43s) We got our textarea replace and I'm going to add 'class.'text_area span 12'. I don't know how long that's going to still be there as a class. I think it is still there. I think that should do it. Save and close. [01:18:11](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m11s) Since we didn't change any of the Database values with this text field, we shouldn't have any issues. But we did add a new text field. If we go to the Compiler and we compile the Component, you will see that it dynamically incremented the version 2_0_1. If we go without installing we go to the Component you will see that it hasn't updated the view because this was open. Before doing anything I would suggest reopening the view, refresh the page. So that the changes will show.
### Install The New Changes
[01:19:01](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m01s)
We can go back and install the new changes. If we go to a Hello World we should be able to open the Hello World and we should see the Alias there and if we click save, it should dynamically add a new Alias. We'll have to do this for every item because the Aliases are saved or created only once you saved the item. I'm just opening all of them quickly. Usually, a user using your Component, you only going to ship this Component when you've got everything in place. They wouldn't have to do all this gymnastics to make sure that all the values are in place. If by some reason you will have to help them along with some Custom Scripting. [01:19:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m58s) Now that we got all our items set and it has an Alias, we can start working on those links.
Go back and install the new changes. Open Hello World, the Alias should be seen there and if it is saved, it should dynamically add a new Alias.,<<<<<<<<< We'll have to do this for every item because the Aliases are saved or created only once you saved the item. I'm just opening all of them quickly. Usually, a user using your Component, you only going to ship this Component when you've got everything in place. They wouldn't have to do all this gymnastics to make sure that all the values are in place. If by some reason you will have to help them along with some Custom Scripting. [01:19:58](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m58s) Now that we got all our items set and it has an Alias, we can start working on those links.
### Changes To Be Made In Dynamic Get - Including Alias