From efd27ee72780f518b95a067c1eeac215b935f797 Mon Sep 17 00:00:00 2001 From: Joseph Geller Date: Fri, 23 Nov 2018 12:38:45 -0600 Subject: [PATCH] Created Basic Fields (markdown) --- Basic-Fields.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Basic-Fields.md diff --git a/Basic-Fields.md b/Basic-Fields.md new file mode 100644 index 0000000..32826e1 --- /dev/null +++ b/Basic-Fields.md @@ -0,0 +1 @@ +Ok we are looking at creating Fields there are two groups I would go Call them Easy or Plain or Common Fuel types Which we will be looking at first We are also advanced fuel types which primarily is your custom field types Which will an undercut after we have covered the admin views and how you connect Fields two views It's quite important because those custom field types Really only makes sense if you see the relationship between views and fields And if you wife already have that knowledge Well We'll acquainted in able to handle Ok so we'll First look at the most more common fuel types Not all of them of course I'm just gonna illustrate to you the text field type And a list field type And all the other sort of follow the same kind of implementation So let's create a new field type We would select Text As our first illustration I need all the magic Lee load The fields here sent all the fuel types default settings we looked at previously When it comes to this information here You need to have a a well Formulated background formulate is all right word there Well it good background On MySQL To understand exactly the What is a varchar What is what is a text what is a medium takes long text Beta basic deleted data type In relation to the database Now I've added the feature of you being able to change that Because I wanted liberate your ability to develop Applications that are more advanced Then A cookie cutter kind of component Builder So this component builder really wants to leave Enough room For you too Make Very advanced choices And 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 gonna frustrate the real developer who is wanting to design something more it well More versatile So I didn't choose that option there are component Builders out there that most possibly have done Done that But I don't want to I wanna give you enough tools to really be creative and so that means a little bit More complexity all over Because of that But if you know PHP and you have worked BHP in relation to sequel Or any other sequel database connections via Java or any other language You will know that there is such a thing as a data type and that has a length And it you can Set some default value to it And you can decide whether it's a key or you need P just realise if you said it as a unique ESA Index type then that means that specific field will only allow a value once And if that same value is placed in it it will you know shout at you and it will be an error So You hardly ever use that Not even for an alias will you refuse that because the alias Implementation in July deals with the duplication within the model When it saves the information It actually checks whether there is an alias in the database and increments the earlier so that it doesn't Conflict Even there you did not even need the That feature But it is available and you might see a need to use it so I added it there it you can choose it And then your normal nail switch weather at the table should be know if it's empty Usually Would use One of these default values and then said it not now Ok and then The story method you will most of the time use default This being because these other methods Require much more knowledge Of what you are trying to achieve And if you do have that knowledge Then I could say that Jason Will mostly be used When You are storing An array of items To the database And yet When you are using list which will look at just now you wouldn't need to use Jason because jumilla simpler Limitation of the list fuel type Deals with eraser ready Unless you are using sorry I I'm not saying that correctly If the list Allows for multiple selection Then you need to use Jason But as far as I can remember I think they let me just check here to be sure I mean the code And here is the place where we sort of deal with you know how are we gonna store the data Are we basically tripping the switches for it And let me just look Down here Ok So If the field type is checkboxes It will It will Going here And it will add it As a Jason Object If there is multiple selected It will add a visitation option object If that The type name is tag If you using a tag field type It will not go in here no matter what you do Let me see Store If it's not 0 which is default Then it will fall back onto this Now if it is check box and you have been selected One of those Features For example If you haven't selected one of these Jason Base64 And it is a checkbox Fuel type Then It will fall back 2 To Jason So that's the default switch So in the switch it takes with what you've said If you said it to Jason it will use Jason if you said it to base you use base Done in the Christian who's that But if you said none and it is a checkbox Eagle said it To Jason so Even if you said The checkbox to default We are still gonna make sure it's safe to say Jason because Zuma doesn't deal with checkboxes correctly In fact it tells you that has a warning on their pages The component Builder Knows that and so it well I know that is why I quoted then So did it wall anyway make sure that we storing it Jason Object and not just the array itself And so This is just looking at the check boxes and other Jason items Flat for the view And So for most things That we are looking at the UI If 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 and now That means if you're not a PHP developer And you cannot figure out where this line Or this that 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 In the XML files and Another files that you are building wait My offline here Another 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 And I will also help you to determine what you need to change for it to possibly work if it isn't working Now there is no way for me to avoid this And the reason why there is no way to avoid them My gym allow themselves Ok so going back to just a normal text field We would just leave it 2 Default These are the options of encryption We will explain in a later video And possibly will not Ever use these I had the need for them in an AC component that I had to develop And so I added This feature is in And it's is this stage it's really Quite difficult to implement If you do not have many Let me put it this way The basic one Which is actually more secure if you were a certain people Is easy to implement But the advanced one Which is for other purposes than just your normal encryption Is little bit more advanced and difficult to implement So for now if you not that it was in your programming skills then You should just avoid these This base64 is often used We storing code into the database A Most of component Builders areas where you can add custom scripting Is is using this base64 As the story method Ok so now we here if we gonna create an email field And I'm gonna say that it's not be required I'm gonna change this to 255 Leave this to default Change that Email This is the name surnames We Uz don't do uppercase And then That's what's gonna be used for the database right So this field All over The system and all the code Is gonna be called by that Name Email Underscore Sorry Lowercase Email Can hear the name The label Is what will be visually seen in the form So They will be adding enter email Will leave the text size the same Max length is good I'm not gonna use it before field and it is if I sorry did It's optional so I can just leave it out Description I'm gonna say an enter Email Gay Remove does relief required False To ensure that it isn't required And then I'm gonna use validate email And I'm not gonna use the fuel option Option is to validate against another field that they both equal Each other We don't need that I'm here I'm gonna place there more Come on And I'm gonna leave those out Today we have an email field Now this validate Option There are some custom validating Auctions in July Email is one of them Then there is a way to create Your your own validation And The way to implement that would be to write PHP up for that so you need to know You know what's needed to Write your own validation And to place it Where are the custom adding in our fields Sorry files To place it in the correct location Where Form builder will be able to get that field validation type And added into your field So is you know What I'm talking about Then you will know where to place it And you later see that in the component Cell phone has an option to add custom Files And how to map it to the correct location Then you can use your own validation figure type there To extend on the validation of shins But currently component other itself doesn't do you know extra custom that it a thing Options it only uses to velocity faults Now that means you can also leave it out and then it doesn't do that it Asian but it still will do filtering And here is a list of the available filters that you'll allow us Ok so that's to create an email A field That is a text field You can target these text Fields with CSS and JavaScript respectively in the list and in the sea Single View The Deuce plural is the list you View single Is there a Single View till the edit view in the backend And all Both of these out most Is targeting The editing view and the listview in relation to its back in display 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 you to the front you need to build a custom front Which we will eventually get to which is called site views Ok so this is primarily targeting your admin area Movie scripts Like I said you can extend the the editing one which is this view Single View To the front Which means it will also extend that to the front The way to Target it this field Whitby That is the ID Plus g402 if you forget that You could look at any other Field And you'd see it says J for underscore And then the field name As a ID I'm just using 5 buck do that And So you that means you can just infront of this e-mail Jason from that email you just put Not in here though But if you want to Target In your JavaScript in your CSS let me show you Are you there J4 Underscore Now you can target it with CSS maybe gala or something That's gonna make it invisible but you can type it in Let's make it black Ben And The JavaScript in the same way if you view jQuery At Underscore in front of the former name The field names are And the nice thing about this Is that you can Add this group to the field And in any view where you use this field The Script wow Following It will go along with it So it will be added to that View Dynamically you don't need to rewrite it everywhere So soon as you working For example I have a I have a script The means to show you That I'm using 4 numbers Movie Nice to show you how the moment Ok found even a better option to demonstrate I had to create a repeatable field Which will not cut later is an advanced fuel But inside of that repeatable field I wanted to add a A date field Now Those of you that work with whom I will know that you can currently Not add A date field Repeatable field So what we did And this is gonna Possibly be very impressing But let me show you I simply used a text field And I added that To it As you can see here we have PHP Riding this JavaScript block And way to add PHP here is he would do the open brackets Question mark PHP And then again Question mark close There there is an a PHP and we are adding the URL jQuery framework Now I would describe I added to the repeated fields Script area not to the actual text field The reason why I didn't add it to the actual text field Because the text field is obviously gonna be repeated right so you gonna have 10 20 whatever takes That that specific text field But with this code I'm able to Target Up to 50 repeats of that Fuel price With Good at saying ok field number we said at least 50 lol And this JavaScript area is being repeated 50 times and increment it incrementally And so the course date field Date again this ID I got from after creating repeated field I went in and looked at the ideal That feel Add a datepicker Can I set the value of the date picker And Basically added to the field And it works very well so Discuss the scripting area For JavaScript can also take PHP inside of it And JavaScript That will be then added to the view in which this field is gonna be used And it's I think it's very very nice feature that we have And it's very useful It's common very useful for myself anyway Ok so we not gonna do that we just wanna use it for creating a simple email field So we will just click save or save and close SA venue So that's looking at creating a text to your type now let's quickly do a list view a list field Sorry Northview So we tick on list And we see that has An option Arrival Stream here How the options are set with a zero Pipe And then the name In a coma now that basically represents one item In the drop down So if you see this drop down here Then Then that is one item That is an item That is an item ok So each of those Would basically be represented between the cars The pipe Makes a separation between the value being stored in the database And a value being shown Today To the person accessing the form Now if that value is the same value So if it If you want to store in the database the same value as the one that Is being Displayed Can you simply drop off The fight with D Initial values like that So it will say option 12 and then that should be See right Option 3 Now That is another Allowed way to use it Or you could say I want one option to be viewed as having not selected anything yet so if you wanted to say Say option 1 Ok I wanna add another option You would say Please Select Auction Comma Bye By adding Because it's getting too long here Select an option By adding a pipe without a value Is being treated as a no So when the form when the dropdown is built Then it will it will be like nothing is selected Basically that option C select an option It's exactly what I did here although this is a custom field this type field I don't have one of those here Sorry But just that you know That will basically Behave the same as that one Gay And then the other values would be selecting And I have a you can use it as it is Or is even a total different value like that it doesn't matter just know that it possibly We would make everything lowercase which if you put it that side of the pipe Now This could be left Out And you can fill in these information based on your requirements So that's how you set up a list field I hope that 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 You see the list for your Gear you study to set a few values that is on changing and which should be soon But with the custom field type which will look at it latest video Hey you can I have another tables values populated the list for you So as it's been created your list gets longer Dynamically and will still look at that and that is obviously available but this is a More static said it wants music over and over where is there is actually We also a dynamic list option which I will never straight later Well that is creating a list for you Let's Quickly also look at a radio button Just very similar If you do Creating a radio button There is no one point to make here If you create a radio button It's see that there are only two values And you can add more than 2 to 2 the list but I always Think of it this way As soon as it becomes a list of values then use a list A radio button should at most have 3 selections or maybe at most 4 and really depends on the Length of the text So if it's yes no and maybe and No thank you oh my Yes No Maybe Not yet decided so that's four options Ok so that could be ok But as soon as it gets a fit value possibly you should look at a list instead Begin with a radio button you can just leave it at You know the default storing method And again the fields Attributes of Very similar to the text Tribute except for this Options array option here Then also liked the list Fuel type in a separated by comma And the store value and the display value a separate bit by a pipe Now it is important to note that You cannot use These Exclamation marks inside Sorry not exclamation quotation marks inside of your values If you wanna use Quotations inside you need to look up the html equivalent Of that Rotation marks and use that And then it all It will work but if you had a Quotation Inside here it will literally break off The Stream right there and you have only one value show up so that's just that you know Ok so that is a radio button let's look at another one quickly colour I'm in is quite straight forward it has a default value you need to remember to set the label and the name Always the type It must not be changed And if you select colour rear And you do change the type You realise that the component builder will simply ignore what you did here And also back to back It will not Because it is a field which When we set up the fuel type The type itself Was said to be mandatory and unchanging remember And That's why you you cannot override it Everything that you said to mana tree and unchanging Will fall back to the setting that you said there in the fuel type and it even if you change it here it will not Change Ok then there is the description And if it's required and show on again the show on feature is something that is very nice As we go we will get to see it in action But you can have a fuel like For example A list field which has an ID to which should be selected So did this colourfield should show So you could say Let's say that this Fields name is Access Or What would be an ideal Let's save you View And then One Would be If in the view field The option with the Value Of 1 is selected then will this field only show up No you can have it F1 Or 4 is selected Then it will show up This implementation is your Gmail Default implementation of the show on field Unfortunately It cannot target multiple other Fields yet as far as I know And that's why we have Important building our own implementation which is far more advanced And which will look at once we get 2 views Ok so that's just looking at colour And and Let's see Another one that's quite interesting is category I suppose In category You have Extension And this extension if you read it Is the name of the extension for which the category will be retrieved for example To list content categories use the value column content You can add also target 1 View Use the value Come underscore component Dot view What that means is that you can just by adding the category field Do a View You Automatically add a category to your component so it will you don't need to map the category at all Thank you cannot map with even if you wanted to Joomla Already has a category component in place And if you add a category of this category type field to which we are looking at now obviously you can Add your own category View And then use a custom field to link it's values to you to other views But if you are gonna use Gmail as category implementation that integrates with your component Then this is the way you do it and then you don't write anything for the category area the Because that itself and adds it to your component dynamically and the only thing You need to do is actually an extension Add your components name now we haven't looked at your component name And that In fact I think we possibly come back to category When we have Come to you know that area of Sermon distributor and where we add in categories to certain views But that you know The categories Can also be targeting just a specific view instead of the whole component itself So it can only be related even to just one specific View Which makes it nice that means you can have a category for listviews you can have a category for Food that you can have a category for this you can have multiple categories in one component This is maybe an overkill but it's none the less possible and the way you do that is Simply your component name Run and the specific views name And obviously the view must be in singular You you cannot target a list view it must be a editable Single View So it is only saying View Ok so that's looking at category will look at category again later stage where we actually will implement Edit is also a very Common Field Which were often using And the editor is Washington in your Joomla content article manager is that big block in which you articles are placed So here you can add such a block to your component And There are some Important things like the buttons and if you read the description we have here it explains to you how it works And including the Hide option And what kind of editor you want to load Obviously You're preferrable one and the alternative one Desire directive And the button option here is really like I said you can read it Hide buttons based on what you selected And then you have a filter option here and required Basically again your normal attributes as with with other fuel types In July Since most of them are extending your base field in Jamal and then Type in name and label and defaulted Bee stings are also available to all the others So that's quickly the editor C Media Just make sure with media that you Select the correct directory If none is said I think it falls back to y22 images What you can start with a specific directory inside of images And I can see there it's mandatory so you need to set it And you can only Target Images itself which is a limitation from Joomla site So that that directory starts at images right so says the attribute should be relative to the top level Images for the So that means let's see you you want to Target a specific folder inside images School food Then you would add that they're like that And then preview if an image is been selected do you want Image to be able to be previewed By her bring over the side of the field and you just change it to true if you want to Again the show on feature is here in the other beforward concepts that we've already discussed Another one that's nice Is notes Notes is basically about a field or like here if we said this is a note But you seeing here And so you can add notes Around your fields And it has very nice Implementation right over there But you can read through And Yeah I think that will be all for us looking at fuel types Well basically looking at the basic field types Common Field types If there is any other field types of you felt You need help with Please look up the Joomla documentation since the implementation is moral a straight forward Trying to not Resign the wheel We simply trying to implement tomorrow's way of doing it And so is he there it is if you type you need more information on you can simply Go look at you Millers documentation on that field type and if they don't have documentation then Can you can go into The field Like I said libraries Healthy places to look CMS Joomla and Legacy in the libraries folder Is the places where these Fields of found So if you look under the CMS folder UK Bipasha fuel type From style content editor to the editor So you wanna know if there is more attributes that Can be used in editor You can open the editor and look through the code And see the The attributes that are Being implemented across the board here it says sent height with acid value offer value So It Goes On And if you see that there is a attribute that we are not already targeting You can like I have to explain Go to the field type open it At the attribute After the name at the value set with its mandatory obviously I think if we left it out it's not And whether it's translatable translatable is an important concept Which not all fields are translatable and And when a field is translatable Sermon sorry component but basically translate it for you So If you look at The It's use this acronym for example You see I added there the label s acronym Then well component builder builds this field into your component it takes that value And it Converts it into a translatable stream widget as to the language file And it adds that In here so that if somebody updates the language file it updates everywhere in the system Which is basically means that Languages are implemented everywhere in component Builders components All the components it's building it translates label for everything that you said to be translatable So if we If we look at Let's go look at a certain Fuel type my text Any property That you said is translatable like here the label is yes And description is yes And that seems to be it Heat it is also translatable it's also said to us Means that you're my world Dynamic not you money Component Builder Will dynamically take hint And translated into a trance as a language string added to your language file And replace the XML with the language string like it's TUT here So That is How you can extend existing fuel types And create Fields with them I hope that is Good enough for you to get your hands into How to get excited about it in to use it Obviously having Fields might still feel very Primitive wall And so next up will be looking at Adding those Fields to views And basically making building your view Itself \ No newline at end of file