diff --git a/029-How-to-overwrite-the-custom-fields.md b/029-How-to-overwrite-the-custom-fields.md index 5e315c3..982e22d 100644 --- a/029-How-to-overwrite-the-custom-fields.md +++ b/029-How-to-overwrite-the-custom-fields.md @@ -1 +1,8 @@ -It often happens that you would like to use some of the default fields Differently than how component builder is actually implementing it Now what is the default fields [00:00:12](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m12s) If you go to Add a new admin view or if you go to an admin view that already exists like I've open one here You'd see that there is this little note Just above adding fields It says that the ID The asset ID the state The access the ordering the created by the date created modified by Date modified Checkout Check out time version Hits metakey [00:00:41](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m41s) Meta description and metadata Is already added to the view so these are your default Fields That always gets added to the view even if you don't create them in fact you don't need to create them But I have seen that sometimes you might want to display some of these fields in a different Area Of the application You see currently The ID field and the published Where is it [00:01:20](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m20s) I think that is State Yeah State field Is the only field that is been shown by Default In the listview So here you can see there is the ID field and there is the states field and the ordering field but the ordering field Obviously Doesn't show the order number you basically click on that button there And then you can move them [00:01:45](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m45s) You know order them so all that is done by Default and so as you can see The sorry The other Values are not displayed in the listview And so I had a client once saying to me that they would like to actually see the date that something was created And also by whom it was created And so I had to adapt component builder so that those things can also be overwritten And this is exactly what we've done What is done is if you create a field In component builder as you would normally create a field and you give it [00:02:23](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m23s) Any of these names you see created by or created date but obviously exactly the same name then it actually will overwrite The default so in this specific view the job order View Excuse me There is a field Created by So I can open that in a new tab there is also a field Created [00:02:57](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m57s) That's basically the date let me just See where it is Oh there it is create a date I'll also open that one So in the Field You see that I basically used The name created by it's obviously a user is the type of field And the label is created by the user that created this is the description [00:03:26](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m26s) And that's all that's needed For a user type Then In the created date Basically it's a calendar type And I used created The date it was created The label and some of its defaults now these values if you don't know them You can actually go and look At the compiled [00:03:51](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s) Field Let me show you that So in the backend of your component that is administrator components Then the relevant component You would open models and then there is a place called forms And you would basically open that And you'd see a list Of forms that correspond to the backend views that you've created so now in our case This job order Is the one [00:04:19](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m19s) You're obviously open the XML So you double click on it And then scrolling down You can look at modified by And some of its default So you gonna overwritten I'm sorry overwrite this value Then you need to update or basically use these values here Make sure this is the only part that is You shouldn't change it if you change it [00:04:45](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m45s) We won't know that you're trying to Overwrite one of Default fields because it basically uses the name As the identifier Ok so back here We basically created the fields that was the first part I'll just close them again And then We would like any normal any other field [00:05:08](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m08s) We simply went to fields And we added those Fields So here you would see you scroll down There's the created date and there is the created by We add both to be shown and also the position and how it should be treated And we said it was be in the left tab Of the 15th [00:05:37](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m37s) Oh yeah that's the other thing If you would like the fields to again display in the same place as before in the edit view Then you would add it to the 15th tab I reckoned that its Very unlikely that somebody would create so many tabs Now what is a tab? If you would to go to the view Then this is tab 1 this tab 2 3 4 5 and 6 So Since publishing can really vary [00:06:14](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m14s) It wasn't Making any sense to me that I would Targeted in any way Directly as the 5th of the 4th So I took a very high number 15 It's not very obvious and this is why I had to make this tutorial If you select the number 15 It will basically add these two fields in the same place it would if it had to build it for you But if for some reason you say no I want to also display the field in a different tab You could actually click and say let's say put in in the 3rd tab you click save [00:06:53](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m53s) And and then you would compile The components install it And then You see 1, 2, 3 it's in the third tab It's showing up So That's All You Had to Do as they had to say and what tab you would like it now to display if go here you would see It no longer shows in the publish tab the create date Its only created by that shows up here so it literally moves the field to a different tab [00:07:24](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m24s) As well as Now displays the field In the listview And that Simply because you added the value the fields here you said that you wanted to display and you added to the third tab I'm gonna move it back to 15 Which is the tab number if you wanted to be in its default place So I click save and then save there compile this install it [00:08:03](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m03s) Basically updating the component Refresh the page and now If we go to where it was it's no longer showing there it's not showing there It is not showing there it's back in published in the correct place that's where it Will usually anyway be set if you don't overwrite it so using the 15th tab As the the target Puts it's in default place And if you use another tab number it removes it from its default place and puts it where you have assigned it to be placed well that is how you can overwrite the custom Added fields Fields of a backend View [00:08:49](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m49s) I hope that will be very helpful Thank you for watching +# HOW TO OVERWRITE THE CUSTOM FIELDS + +* ### Using Default Fields With Custom Code + +It often happens that you would like to use some of the default fields differently than how component builder is actually implementing it. Now what is the default fields? [00:00:12](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m12s) If you go to add a new admin view or if you go to an admin view that already exists. You'd see that there is this little note above adding fields. It says that the ID, the asset_id, the state, the access, the ordering, the created_by, the date_created, modified_by, date_modified, checked_out, Check_out_time, version, hits, metakey, [00:00:41](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m41s) metadescription, and metadata is already added to the view. + +???? +so these are your default Fields That always gets added to the view even if you don't create them in fact you don't need to create them But I have seen that sometimes you might want to display some of these fields in a different Area Of the application You see currently The ID field and the published Where is it [00:01:20](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m20s) I think that is State Yeah State field Is the only field that is been shown by Default In the listview So here you can see there is the ID field and there is the states field and the ordering field but the ordering field Obviously Doesn't show the order number you basically click on that button there And then you can move them [00:01:45](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m45s) You know order them so all that is done by Default and so as you can see The sorry The other Values are not displayed in the listview And so I had a client once saying to me that they would like to actually see the date that something was created And also by whom it was created And so I had to adapt component builder so that those things can also be overwritten And this is exactly what we've done What is done is if you create a field In component builder as you would normally create a field and you give it [00:02:23](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m23s) Any of these names you see created by or created date but obviously exactly the same name then it actually will overwrite The default so in this specific view the job order View Excuse me There is a field Created by So I can open that in a new tab there is also a field Created [00:02:57](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m57s) That's basically the date let me just See where it is Oh there it is create a date I'll also open that one So in the Field You see that I basically used The name created by it's obviously a user is the type of field And the label is created by the user that created this is the description [00:03:26](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m26s) And that's all that's needed For a user type Then In the created date Basically it's a calendar type And I used created The date it was created The label and some of its defaults now these values if you don't know them You can actually go and look At the compiled [00:03:51](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s) Field Let me show you that So in the backend of your component that is administrator components Then the relevant component You would open models and then there is a place called forms And you would basically open that And you'd see a list Of forms that correspond to the backend views that you've created so now in our case This job order Is the one [00:04:19](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m19s) You're obviously open the XML So you double click on it And then scrolling down You can look at modified by And some of its default So you gonna overwritten I'm sorry overwrite this value Then you need to update or basically use these values here Make sure this is the only part that is You shouldn't change it if you change it [00:04:45](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m45s) We won't know that you're trying to Overwrite one of Default fields because it basically uses the name As the identifier Ok so back here We basically created the fields that was the first part I'll just close them again And then We would like any normal any other field [00:05:08](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m08s) We simply went to fields And we added those Fields So here you would see you scroll down There's the created date and there is the created by We add both to be shown and also the position and how it should be treated And we said it was be in the left tab Of the 15th [00:05:37](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m37s) Oh yeah that's the other thing If you would like the fields to again display in the same place as before in the edit view Then you would add it to the 15th tab I reckoned that its Very unlikely that somebody would create so many tabs Now what is a tab? If you would to go to the view Then this is tab 1 this tab 2 3 4 5 and 6 So Since publishing can really vary [00:06:14](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m14s) It wasn't Making any sense to me that I would Targeted in any way Directly as the 5th of the 4th So I took a very high number 15 It's not very obvious and this is why I had to make this tutorial If you select the number 15 It will basically add these two fields in the same place it would if it had to build it for you But if for some reason you say no I want to also display the field in a different tab You could actually click and say let's say put in in the 3rd tab you click save [00:06:53](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m53s) And and then you would compile The components install it And then You see 1, 2, 3 it's in the third tab It's showing up So That's All You Had to Do as they had to say and what tab you would like it now to display if go here you would see It no longer shows in the publish tab the create date Its only created by that shows up here so it literally moves the field to a different tab [00:07:24](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m24s) As well as Now displays the field In the listview And that Simply because you added the value the fields here you said that you wanted to display and you added to the third tab I'm gonna move it back to 15 Which is the tab number if you wanted to be in its default place So I click save and then save there compile this install it [00:08:03](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m03s) Basically updating the component Refresh the page and now If we go to where it was it's no longer showing there it's not showing there It is not showing there it's back in published in the correct place that's where it Will usually anyway be set if you don't overwrite it so using the 15th tab As the the target Puts it's in default place And if you use another tab number it removes it from its default place and puts it where you have assigned it to be placed well that is how you can overwrite the custom Added fields Fields of a backend View [00:08:49](https://www.youtube.com/watch?v=FHQfIhWHYyQ&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m49s) I hope that will be very helpful Thank you for watching