![]() ![]() Making time for regular research to find possible improvements always pays back. ![]() It’s always great to discover new features for tools that you already like and use. Live Templates are convenient and really save your time. Those were just some examples that can be useful and I’m pretty sure you will add plenty other as you use this feature more. So just type the abbreviation of the live template: custom_drupal_form, then press Tab (by default) and receive basic functions for the custom form. Here you can see a variable $FORM_ID$ which you will be able to insert while applying a live template, and that makes it flexible for different modules. Or just start typing emd and choose it from the tooltip. Now you can just select any node nid (like predefined constant in your code or argument from the url, or nid of related node) and wrap it with emd function. This way it will be easy to search in watchdog for errors debugging. Therefore, by default there will be the first word of a filename, without an extension. In this case – as you can see in the screenshot – I used two of them. Live templates are quite flexible with variables, there are some predefined expressions for most purposes (to manage them, just click *Edit variables *above options). ![]() Here I’ve used the variable ‘module’ and created a template for it. (Shortcut: Alt ⌘ J in Mac or Alt Ctrl J in Windows):įor easy access and manipulation of field data we usually use entity metadata wrapper, which is provided by Entity API, so it might be a good idea to have a template for it: Now when you select text in your template, you will be able to wrap it with the t function. Make it applicable in necessary file types. $SELECTION$ – predefined variable, used for surround templates, will be replaced by your selection in code after applying live template. Live Edit gives you an opportunity to see all the changes instantly in a browser without refreshing the page. *Template * text – basic logic of the template. 1) t functionįill *Abbreviation *field with the command you want to call the live template with. The day after installing Live Templates, I have extended the base with 3 new templates useful for me – t function, get entity metadata wrapper and constructor for custom Drupal forms.īelow I would like to show you how to do this. For some of them you can find a predefined template, and if not, you can create one yourself. There are a lot of standard subtasks that developers usually perform when working on projects. There is also an option to add new live templates, and it brings even more benefits. Third, when I switch other files in the IDE, it will cause some confusion. ![]() Secondly, I deploy the web file in tomcat, and I can only debug one file at a time, so I have to restart tomcat frequently. (Tip: if you use OSX
0 Comments
Leave a Reply. |