 All right. Hello. There's a few more people still shuffling in but let's get this show started If you love PHP template, I have bad news We're here to talk about twig but not only twig also the other changes throughout the theme layer for Drupal 8 to Make things better for front-enders everywhere. So we'll just start with the introduction. My name is Scott or Kotzer I'm a just a developer Drupal developer at Digital Kidna. Just a quick shout-out to them for sponsoring me to come here, which is great and Fabian you want to introduce yourself? Yeah, I'm Fabian France or Fabian's on Drupal.org It's one crazy day. I had this idea of That this twig there was this little problem to solve and I was like it wasn't that hard and Suddenly I was together with Jen leading this initiative, but we had success and it's very nice So I'm currently a tech one consulting loving it and yeah, hope you have fun with the session Hi, I'm Joel Patete and I jumped onto this twig project just to help out and I got sucked in and it's been good so far because It feels a lot better than the PHP template that I used to use And I'm Jen Lampden. I'm also independent. I'm working on the twig project for the last year and a half Really hoping it Gets everything everyone wants out of it done. So Anapony All right, so now that you know who we are Why are you here and what is this talk about? we want to talk about the pain and What we have done and what we are going to do to try and take that away and so to give you a better theming experience So we're gonna talk about syntax Inconsistency complexity redundancy and security and so this is just an overview. So we'll talk about each of these I think Jen do you want to talk about syntax? Sure, so there are a couple of problems with the syntax in in Drupal 7 First starters that when you are printing variables in your template files There are lots of different ways to identify your variables If you're printing an object you print things out with an arrow if you're printing Something in a ray you print them out with square brackets. Sometimes you just print things And it for people who are experts in HTML and CSS They shouldn't need to know the difference between an object or an array or how to access bits and pieces of them And more importantly, they shouldn't need to know which things Drupal decided to make which other things And it's kind of would be nice if we could print everything the same way and let the people or experts in the template files Do what they do best and leave the yucky stuff to the developers So in twig we've eliminated the need to print things differently It doesn't matter whether it's an object or an array or a plane variable. If you want to print it, you just print it So It's a lot better. Yeah There's also different ways we print things in Drupal 7 Sometimes you just print them to the page and sometimes you have to print render them Not only is print rendering things a little bit redundant But it's another one of these things where we're leaving it to the front end community to understand When Drupal requires that you render something and when you can just print it where we really should just be able to print everything The same way so in twig we've made it so that you don't have to render your renderable So you can print them exactly like you print everything else and twig will handle the rendering for you Just print it And inconsistency is another pain point so many different ways of doing the same thing Sometimes we use template files. Sometimes we use theme functions Theme functions are always a pain to override and when I was learning theming Drupal I thought that it was crazy that you have to take this whole function and copy it into your theme and then just change these Little bits and it also means that you need to know PHP basically to change that markup So in Drupal 8 with an asterix only template files are provided in Drupal 8 We're probably going to drill this into your head by the end of this But we need your help to make all this a reality. So if you're still in town on Friday, please come to the sprint No matter your skill level and experience you can help trust me If as long as you have built a site in Drupal you can help us out and help yourself out at the same time So and also the just the sheer amount of template files and theme functions We can't even show you them all and you can't read any of these There's a lot of them and It's it's just sort of it's too much. It's too many layers. It's too complex so We are trying to get rid of them consolidate them if they're the same thing. Let's just use the same template But we need your help and I'll pass this on. This is talking about render arrays and theme functions You must take that I Can take that So in general we had a very big inconsistency there In general most functions and core would already kind of do this they create this big arrays with a build and Then you would kind of have this As an render array but there were also lots of places and core where you would actually call the same function and We are actually very close to deprecating that from Drupal Drupal 8 which means that overall what we can now do is we can do lots of Things within the rendering system that have before hadn't been possible because we now have one consistent way to call it So if in your modules, you are still kind of using Theme calls Start converting them now that will also help with performance caching other things Trust me. It's worth it. Yeah, so it's basically it's taking It's it's taking the call to the theme function and Convert that to a render way with hash theme equals So it's it's usually a fairly straightforward Conversion to this new way and like they mean was saying there's so many benefits and Complexity is another pain point. This is this is one of my favorite slides because it looks it looks so evil. Look at it So this is pretty much what Drupal 7 looks like John Albin Wilkins who is the One of the theme system maintainers and was for Drupal 7 as well Sort of figured it all out and created this diagram and I sort of like to refer to this as the monster that we created So we're trying not to do that this time We're trying to sort of think through and think about the use cases and what people actually need So and there's a little story to that When we finally at the last Drupal con after five days of extensive sprinting Got trick at least secured almost in core the mega patch was ready It just had to be kind of applied and it was applied the next day and I was flying back Jen and me was sitting last in the coding lounge and we are like Jack Debating those things anymore and then we kindly found well We've just designed a new theme system in five easy steps and that's it. Yes So Yes, I'm glad that you told that sorry Fabian because that's very important to this a lot of a lot of twig happened after hours and Just putting in the extra effort to make this happen and make this a reality for everyone and that's that's a perfect example so It's sort of it's it's adding a few things, but it's also taking away and simplifying so we'll talk more about this later but it's just It's not jamming most of this is just not jamming so much things in pre-process that don't really belong there So anyway, we'll talk about that later and we do still need your help. Yeah And if you know form API, you will kind of love it because it's very similar. Yeah, it is very much like form API and Redundancy and we ask around in Portland actually and people were like, hey, I get it. That's nice So we got positive feedback and so we continued with the initiative. Yeah It's something it's something that's familiar to a lot of developers already. So the structure So redundancy this is a huge win that we get with twig If you're creating node templates, for example, you have node article You have node page and you can get more specific than that, of course in in Drupal 7 you would be forced to basically Well, the standard way anyway would be basically to copy your node template But then you have to maintain four or ten or twenty sets of the same markup just to change one part Twig actually gives us real template inheritance. So you can say On the right side here where it says extends node.html.twig We're just changing one part So it's you actually have like a parent-child relationship and you can just change the one part you need to change So all you do is you add the code block if you see on the left. There's code block footer Towards the bottom. All you do is you add that to your parent template That allows you to override that bit in your child template essentially in the nice thing about this inheritance is it works exactly Like class-based inheritance And it's simulating that and it's fast It's the fastest inheritance in seeming engine implements and I think this is also nice because It sort of gives us justification for also reducing the amount of templates because I think previously the reason for Creating all these little small atomic templates was oh, well, what if you just want to change this one part? so that's not really an issue anymore, so I think that will also help us to reduce the amount of templates and Again sort of coming back to this It's another part of redundancy that we have many things Templates and theme functions that output almost the exact same thing and we want to consolidate them and use actual theme suggestions Which is something we've had in core for a long time, but we've never really leveraged it so if you're creating an item list and Whether it's of users or tasks We can just use the same template because you will still be able to override each of those on individual basis If you need to so for example the middle one you could say item dash list dash dash users dot HTML dot twig and that would override just that that bit of markup and I will definitely pass security onto Fabian Yeah, so One thing about trick here is that especially in PHP template you could write arbitrary PHP data and If you have ever worked with a more complex theme That was kind of builds by someone not yet familiar with the Drupal way of doing things What you ended up with was a lot of business logic was in the same and template files and Even my SQL calls and cetera, so it would make things You want to have a clear separation of presentation and business logic layer and there's nothing enforcing that in Drupal 7 And also what you could do in Drupal 7 more from a security standpoint you could just print out unseal-realized data and There was even at one time a possibility for There was a change from title to label, but if your Seam was still using the old way because it was kind of Not yet adjusted to that change then immediately you would have a cross-site scripting attack and Quora even had a bug here that allowed you to suddenly print out and sanitize data Yeah, and so and if it if it's hard for the experts to get it right then It's even harder for the non experts or those that should not be experts in security to get it right as well Yeah, so basically what we're giving you is smart defaults out of the box so that you don't have to worry and lose sleep over this stuff So and we do we do still need help though in in making auto escape a reality We have some work there, but again, we need we need help. We're only a small team on the other hand out of escape It has been in a way also worth it to wait with auto escape until the entity API is Stabilizing a little because we are now getting something completely different than we did three months ago. So, um, yeah Because there's so many changes any auto escape implementation that we would have had before would probably had been changed by now Yeah And I love this because well Jen Jen made this slide and when she was making it she accidentally dropped her note table So I mean this is sort of what that would look like in twig, but it won't do anything It'll just give you an error. It'll say what is DB query. I don't know what that is So you can't even if you want it to you until some evil person makes a contrived module But the person but it needs to depend on the bad judgment module has to So getting all this we do need to make some API changes Of course new template is definitely an API change sorry new template engine the new theme hooks which I briefly mentioned making everything renderable Which we've already touched on a little bit and markup utility functions, which are sort of evolving and We're still sort of defining what that will be because as we're developing this we have people like Morton who are kicking the tires and Seeing how this stuff actually works in practice. So we're trying to figure it as we go What what tools are actually useful to themers? And the markup utility functions is sort of falls under that category as well as the theme component library So new template engine, sorry PHP template was our engine. It wasn't really an engine It's technically still in droop late, but that's because it's like 30 lines of code 50 Not very much You can use it, but you won't want to because everything is going to be set up Perfectly to work with twig and we'll have all these lovely contrib themes that you guys can build and it looks pretty look at that nice little twig a New theme hooks I will pass this on to Fabian as well because this is sort of the brainchild Okay, so for the new theme hooks Kind of what we found was the old theme system was It was something that was very very flexible and it could do let you do many many things But it couldn't let you do the things that you actually want to do So we kind of found We need a negotiation phase in which we kind of say what will be the suggestions and what will be the Templates we want to find we want both themes and modules to define suggestions so that I Can for example say well I see in my variables. There's coming in the special This special variable and based on that I want to do something They are this is not yet in but probably something because it just makes sense I would like to do it even more just have a generic context. I can check and pass over and And But that's a little more in the future But again, I can do based on some data I can do passes suggestion and I can create it my prime example always is I have a map kind of like And now someone's making a collared map. So then for the collared map. I want to add suggestions as well and so I can kind of get a kind of inheritance structure here and the nice thing about Seam suggestions is that now I'm first adding my suggestions, but still my My default suggestion which which I was called would still be kind of the default one because There's still a way to kind of call Directly passes suggestion to the render array like item lists underscore underscore user But now we are introducing a seam suggestion alter where again you can not only add things But you can also alter things. So if you want to say even though this has been coming in with an item list underscore underscore users I could still alter it and have it be my fancy users or whatever and I can kind of overwrite it all and We are here now. Finally in our standard System like we have it in Drupal you create those things you alter those things and then the same is kind of Happening for the prepare we kind of already had a prepare and a prepare also stage But it was named very weird The prepare stage is kind of your template pre-process hook and then your alter stages your hook pre-process hook and it's like it wasn't clearly defined and Also what we couldn't do we couldn't do a prepare or prepare alter on the suggestion We are getting so again if I have my colored map and I need to do any preparation I can't do it directly and in Drupal 7 it's even more complicated because it can't even get the suggestion It was called with so I really can't do my colored map preparation in the way I wanted to do and this new prepare call we are introducing is allowing to do you do that for you so you can Can get your preparation done and afterwards you can again then alter it but it depends on you if you want to add something or if you want to alter something and That again is very powerful and what's especially nice about the hook prepare is a hook prepare underscore underscore So hook prepare for example for a note I could and I have a suggestion like a note article and And so I could have a January cook prepare which is for running always. I could have a hook prepare underscore Note which is just running for notes better can also have a hook prepare underscore note underscore Article double underscore and in that case I get called also for suggestion So that's very similar to form hook form for my the alter kind of the exact same Mechanism and that will allow much flexibility and getting this things done and afterwards you can even alter on again the same three things And and then after we're kind of done with that then we kind of Give set back to the drooper render and that can and then we are from a seam engine just rendering either Our normal template or the negotiated template that was prepared in a different way that way we have Finally all the control we need in the same system here Yay, thank you, baby and It's it's sort of a little too early, but pre-process I Mean you'll still have that tool But the actual like hook pre-process might go away still it sort of depends But with with the prepare and prepare alter you'll have all the same tools and they'll probably be even more powerful if we can get Contacts available as well. So and everything renderable. We talked about this a little bit more Here's some nice Legos as lovely photo from Gabor Which oh yeah Legos so basically with renderables There's many benefits they've been touched on like security for one The other thing too is that they're alterable So we're not that way you're not just dealing with a flat string that you can't do anything with So we just pass these renderables whether it's an array or an object down down the chain So that you can still hook into them later and alter them if need be because there's nothing worse than trying to update some certain piece of markup or some certain theme output and you're looking at a string of HTML and Like you're gonna do a regular expression on it like that's just not right and markup utility functions I'll actually Fabian or Jen can jump on that too Because as I said, that's that's sort of evolving a little bit So markup utility functions come from a very simple need and the need is inline templating What I want to be able to do is I Want a link is probably too simple But for a field or whatever if I have any renderable I want to be able to embed that within another template and I don't want to have a suggestion For everything I need I just want to be able to create bigger templates which have kind of like inline templates but which still have my prepare stuff running and I have a proof of concept now that allows you to kind of access the parent Access still the parent context So you can still kind of if you have a note you could have still the no title etc available but if then you are rendering a list then you can have this in this list you can kind of Get the same output as in the item list dot HTML dot trick That will be very powerful in itself, but there's a problem We removed seem link for example and now we are no longer That's a good thing because it was a huge performance win, but there's something in Drupal 7 and Drupal 8 That's still a very big hack because if you are doing a type link what happens is it defines a pre-render function So at the time we are coming to the seam layer the link is already Rendered and that's not changing if it's from a root or whatever like in Drupal 8 That's a problem Things shouldn't be rendered to mark up under the seam layer had a chance to kind of say well I Don't have a default implementation for seem link. There are no suggestions. I'm early returning and That's just one is set in the registry. It's very cheap. I think you can already now Set an empty function, but it's not really defined in the registry That's kind of where I'm still seeing but on the other hand Drupal pre-render link has to die It needs to be a Drupal render link and or even a Drupal seam render link That's kind of it's not a seam function per se because you don't want that But you still want fast links or you still want fast Whatever things fields or whatever that are just not fast enough for trick to compile and doesn't really make sense to kind of Bootstrap everything today do a Echo dollar content or print dollar content like that's not make sense because it's so generic also for links It doesn't make sense. It's so generic, but you still want one to have a defined template so that you can for example do inline templating for a link or you can do Can Include your link in something and you can render pre-render your link and there's lots of things you can do but this Drupal pre-render that's a problem because pre-rendering to markup is Is not going to work out and that's kind of to what markup utility functions now have evolved that Instead of Drupal pre-render link We need to Drupal render link and that's it and this is just and property was in the render area as well but it can be overwritten by the seam and If the seam has something it gets called if it doesn't have something then the default fast implementation gets called and that again gives you very much flexibility and Possibilities why not sacrificing any speed in the Drupal Drupal 8 core standard installation Yeah, what he said So one one thing on this all the the getting rid of the theme The theme functions making these markup utility functions All of this the goal in mind is is to give the themeers something to wrap their markup around so you get their raw data instead of a String of HTML is already there and you have to find out how to change it So at the theme at the template level you have the access to the raw data and you should be able to change What's around it how it's going to be displayed on the screen? So you want like say your first name last name and you want to wrap it in a span tag You got access to those raw data instead of the spanned already markup that you're getting so that's kind of the overall idea of why we're doing this and why we're trying to put all this information is to give you access to the information and So you can change it at the level at one level instead of looking for it within Drupal Yeah, it's you definitely get more flexibility and Then the theme component library. I think Jen is probably the best person to to talk about this one So back when we started this whole crazy twig idea We spent a couple of hours in a room trying to figure out like what the components We wanted to have were for a theming like what are the the pieces that you reuse all over the site? And we completely failed at that exercise because we couldn't decide how small or how large the pieces should be And so we put the task aside for now and we started working on converting all the stuff We've had in in core and making sets of things that we see together So when we see lists or when we see tables or when we see for example a thing that has a title in a content area We start to see patterns emerge and that's helping us determine what our library of components should be We're gonna narrow all these things down So instead of having four ways to do a list will end up with one instead of having four ways to do a Block with a title and a thingy or a div with a title and some content We'll end up having one or two or a smaller subset And then those things will be documented in a clear place that will say these are the components that Drupal core includes You can get all these little pieces and you can reuse them and hopefully that'll make contrib module developers when they need to print out Div with a title and a thingy instead of making their own div with a title and a thingy Which is how we do it now They'll look at the list of components they say hey, there's a markup that I need. I'm just gonna call that existing template Maybe I'll give it a new Template suggestion. So if you wanted to overwrite only that one, they'd be able to So the theme component library right now is like a task to document what the components are in core We're still working through all of our conversions and consolidations So we don't have a set yet But we will create one before Drupal 8 comes out just that you have a list of things that are available and things that contrib developers should use This is something that won't ever be finished right as we go forward in time Contrib will come up with more patterns and we'll be able to create More components that will end up included in core and so it's a evolving list Like whatever the web decides to do with its components will end up getting in here at some point So it's a wish list item that we're working hard to get towards Yeah, and there's also been work for and that's again connected to the Markup utility function work because we converted actually some things from seem back to type and types are actually already a very Kind of not granular enough, but they're already kind of like a kind of library of things for that But now that we have that library unfortunately, we cannot do anything anymore on the same layer with it So that's kind of the problem Yeah, so yeah design patterns and not repeating yourself 10 million times Okay, and also you win so we're gonna talk about some of the benefits from Mostly twig and I think partially then the new sort of theme layer theme architecture as well These were things that we didn't know we were getting into when we first started down the path to twig Yeah, well the more we started using twig and converting stuff the more stuff We just discovered that we got for free by using twig. Yeah, so extra bonus free stuff So template inspection variable inspection the possibility of using the same templates on the front end in the back end because they're not php And then some more possibilities basically for contrib well that would be contribute to but being able to edit templates in the browser and Having the code and you I talked to each other so more about these in a second So template inspection This is one of the first things I worked on as part of the twig initiative and I thought this is awesome I I didn't well I didn't really write the code. I wrote tests, but I helped get it in Yeah, okay So basically this is like develop theme or but in your web inspector so you view source or however you do it inspect and You will see for each little bit of markup what was that what theme function or Template was called and you'll be able to see what other possible templates can I use for this particular case? So this is great because there's no more hunting down Where do I override that certain bit of markup you can see it isn't that awesome? So this is just a toggle the little bit at the top settings twig debug equals true this is just a little toggle in your settings dot php and twig debug also turns on twig auto reload Which automatically recompiles your templates because twig compiles these templates to disk so that they're fast So as soon as you turn on twig debug like basically when you're developing your theme you're gonna have twig debug on so you see all this wonderful stuff and When you save your template it automatically gets regenerated. So big win Yes, the X is the one that is currently used So yay for that and also I should probably just call this out it gives you the full path To the actual template that's being used so you can just you don't have to hunt for it You can find that file and just copy it into your theme. Whoo. So and Then we also want to do variable inspections so that you don't have to I mean you can do this already You can just use dump, but we basically want to give you like Something like crumo, but nicer So that you can actually see what variables are available like within the context of your template What variables are available, but not the stuff you don't care about as the theme or because right now if you're trying to deal with the Render arrays of doom from Drupal 7 all the stuff you want is in there But there's also a bunch of stuff that you don't care about and you have a really hard time waiting through all the stuff You don't care about fun stuff. You do care about so we want to build you something It'll be like here's what you want and then you can kind of figure out from what you want What you want in front of the page without having to look at all the stuff Yeah, it'll tell you what you want what you really really want I Went there that's another big selling point for trick because we have dynamic extensions So you can extend it So even if the variable inspector might not make it into the quality and quarter that we would like it there's nothing from hindering a contra module for just defining a trick extension and Then they can kind of provide the DPM methods, etc. And that would all kind of automatic Kelly work and So it's very nice. So trick gives you a lot of flexibility if you need anything extended You can do that. Yeah, that's that's a great point And this is one thing that we sort of researched and found we we haven't tried this we hope that someone does But there's things out there on github and elsewhere Like there's a whole ecosystem around twig that we're just jumping into and hopefully we can participate in as a community But there's for example, there's twig.js which could give us the possibility of using the same templates like say for a node or something Not only in Drupal, but something out some kind of back-end JavaScript library like backbone or something like that again, we haven't tried this, but maybe you can maybe someone can make a module and Then in browser template editing I'll pass that on to Jen or whoever wants to take it How many people heard of the the contemplate or the content template module and maybe even like admit to using it Maybe like well with triple five like I didn't know any better, right? I used it This is one of these modules that exists because people need it or people want it They think they need it You want to just be able to find the template file make a change and hit save and be done with it without having to Worry about all of the other stuff that goes along with that Unfortunately, when your templates are full of PHP code Finding the template and saving it at least the way contemplate does into the database is a big problem It's a problem for security reasons and anyone who has access to that at your Contemplates can put in Equal things and drop your node table if they wanted to for example but also it's a problem because if you don't exactly know what you're doing with PHP and you forget like a closing PHP tag or a Semi-colon your whole site explodes and you have to then manually go dig through your database and find where that thing was stored So that you can clear it out. I've actually done this again not to admit anything To find the problem and get rid of it. It's just like a dangerous thing It's also dangerous to take these files and save them to the desk There's just like a lot of issues with with in browser PHP editing But if the template files aren't made of PHP code anymore a whole bunch more opportunities come up Especially with something that can be like parsed and checked ahead of time and validated and and now you can you're like Oh, okay. I can edit these files in the browser. I can save them. You can have them export You can there's lots of potential here for taking this contemplate module and turning it into something That's good and usable and wholesome. Yeah, we can check the syntax before it goes live on your side Which is probably quite helpful the other thing is With contemplate it was loading from the database database and Again you might have there a bottleneck and have problems kind of because you need to run the PHP in memory So it's not cached. We are other caching mechanism It was just flow and the advantage here again of trick is you can pass it to string You can pass it something from a database from the universe somewhere or wherever your source is coming from in the end Your trick template is compiled to disk and then cached and upload loaded from there and that's very fast Yeah, so this this won't be in core again. This these are possible contrib toys so if anyone is feeling inspired see in the Coder lounge and This is probably another one. I'll pass to these fine people Two-way communication between the code and the UI or I guess making the UI not lie So how many of you have? Had a custom theme and you've gone into the theme settings and you've done something like try to disable the logo or turn on The site name and realize that your theme didn't care about that setting, right? We've always had this problem in Drupal where there's user interfaces that have settings and there's code that can choose to Pay attention to the settings or not And there's always this debate about like well who wins does the setting win or does the code win and the code is always one But we're finally in a place where because we're parsing these files ahead of time We can check in the file to see whether the file is gonna pay attention to that setting or not and do something really clever Like disable the setting if it's not gonna be used So because we're parsing the files ahead of time we can make some smart changes about the user interface So initially we're like yeah, no no broken UIs. This is great But then we're like wait wait wait, let's take us a little bit further if the System can be aware of the code. Can't we just write our template files first? Okay, okay, that's something that people have been wanting in Drupal for forever Right, you don't want to pull a template file out of somewhere in some module and like write around it You want to write your own markup, right? You guys awake? This is like a huge huge huge thing, okay Anyway, so if you could write if you wanted to write your markup you could write your markup in theory, right? We don't have so some work yet You could write a template file and if you knew the names of your fields and you knew the names of your blocks You could put them in the thing and you could put your template file into your Drupal site and then your Drupal site would build itself Maybe It could happen anything is possible Yeah Yeah, I actually I that part is still blowing my mind so much Even though we've been talking about it for months that I forgot to even sort of mention it when I was segueing so yeah, wow That could be great, but we need someone to build it or a group of people or an army and Again, you can help us get there Twig is in core. It's not going anywhere, but there's so much more we can do So this is sort of a short list of what we're working on We're we are working on those theme system architecture changes those little blue blocks blue boxes that you saw We're working on trying to convert all or as many as we can Theme functions to templates so that you don't have to take all that theme function PHP and copy it into your theme we want to get rid of that and We also want to have less templates consolidate get rid of stuff and We want to clean up markup and that's where you guys can really help to If you don't even know PHP, but if you know your markup, you know your HTML and your front-end stuff You can join mark Morton and he is He's like he's taken time off from client work to get your markup nice and shiny and clean So I think the least you can do is help him out right so come to the sprint on Friday and help us out and Get rid of well like Drupal is kind of known for divide us, right? So let's change that right and We can clean up preprocess too so The twig initiative is sort of special initiatives and quotes because it's not one of the big six You know once that trees talked about this morning. It's sort of an underdog if you will and It's brought along many new contributors myself included and as it turns out, you know all the twig templates that Got committed in Portland. There were so many new names working on those issues that no one had heard of and they just They saw that there was a place where they could jump in and help and they did so Again, you guys can help and and we can really use your help so So come to the sprint on Friday We have tasks for every skill set. We have mentors like myself and Joelle will be there And if you have never contributed to core you can come in the morning there's a community tools workshop where we'll get you set up with a local development environment and IRC and all these good things make sure you have an account on on Drupal.org and Basically get you all primed up and ready and then you can go into the sprint in the afternoon ready to rock and There's also Drupal mentoring tweet stuff and yes come to the sprint Again come to the sprint. There's also more sprints on the weekend. We meet every week on Thursdays We do a Google hangout Join us anytime online 24-7 in hash Drupal dash twig on IRC and Also for the adventurous among you start building your Drupal 8 themes and let us know how it goes It's still a little bit early, but we could really use your feedback Like I said, there's not a lot of people kicking the tires So if you're sort of an early adopter if you're feeling brave Just start building something and if there's something that you find is really missing let us know create an issue and so on and We also want to mention if this is your area if your theme or check out all the other amazing talks about twig in the theme system to more morning Fabian potentier the guy who Who is who basically wrote the twig template engine is doing a talk? That is tomorrow morning at 1045 a.m. And A bunch of us folks are doing a and Morton are doing a Well, especially Morton really Are doing a twig at ship it aka the twig lab that is tomorrow at 1 p.m. And that will be a lot of fun so come to that and if You're sort of if you want to talk to us more there's a boff thursday 2 15 p.m. So yeah I'll turn it over to questions now and I believe there are a couple mics over there, so if you just want to That way we get it on the recording to I think the biggest use of functions and templates is the t function How do you handle that with? Come to the twig lab. We will tell you exactly it's We have a t filter and then we also have a trans block and it's we have nice really clean ways of doing translation We have a wonderful really really wonderful trans extension It didn't make it on the slides, but it will be in the twig lab. So there's more for you to explore But it is really wonderful because instead of writing all these placeholders and having to deal with all this Very long strings with markup attach what you do is you're writing like your normal markup And you're just adding a hash trans and you're starting your trans block You can set the context etc for the language thing and then it will automatically create the t function for you And that's the really genius thing about it and you can just then just use your note Note nid etc. And you can just use your normal variables and it will then automatically convert those into placeholders and replace them and Trans extension is awesome. So you don't need that ugly array Syntax thing that we have now when you use the t function if you want to pass variables and it's really slick. Yeah, great question morning I'm just gonna steal the microphone for like two minutes and actually talk a little bit about what we're gonna do tomorrow in the Twitter actually let me do up. Yeah, come on up So I'm not one of them who actually coached the PHP I'm just being the angry man in the end. It's these fine young people delivers the stuff too So what I did a couple of weeks ago I began to actually build a theme and find all the arrows and figure out where we're at right now and What I'm gonna do tomorrow is gonna do a demonstration of all of these things so About all of the questions that comes out of this is gonna be sure not in direct live code because I'm not that brave It's gonna be screenshots and little bit of pieces of code But it's gonna be based on the way a front-end developer looks at a theme So if your PHP nerd will give you a half an hour at the end where you can do your stuff But the first hour will be dedicated to pure front-end love Web check introduced a new new word about the developer experience I'm introducing a new one that's called the front-end experience because that's a that's a very very important thing for us and the thing we've been Hold back on for a couple of years now in Drupal is not as much working with PHP, but it's just been ugly It's not how front-end to work. It's it's this Piece of fucking shit that none of us want to work with And I want to change that and that's one of the things we're also gonna talk about tomorrow all of these principles We're building on it. This is not only about changing a variable to something with two brackets on this is also changing the way We're thinking theme and the only one who can define that is us That is if you're front-end developer theme or whatever you call you I want to have you in that lab because I need your opinion on this and I Really need help because I used to I used to bash John Olpin for Drupal 7's lack of finesse He now passed that torch down to me and if I'm the only one you're all gonna suffer from my bad judgments You don't want to do that. That's that's insane. So tomorrow at one o'clock. We're gonna do that lab We're gonna have a bath after that and even that you don't know how to conchip to core I actually need opinions about these things. I need people who can give feedback Because a lot of the questions right now. We're trying to kill the JS classes so everything that JavaScript want to put in As a class in your body feel your notes or so forth. I want to take that stuff and put that out as a data attribute I'm not sure that's a good idea or bad idea. I need somebody to help me out with it And here's another thing all the back-end developers. They're not paying attention to the front-end right now This is now we're gonna get it done Thank you morning next question. Yeah, this is for Jen. Okay, can you please repeat the last feature you are talking about? The one you get angry for I'm sorry theoretical feature. Yeah, okay, so In Drupal land right now the way you normally create your markup is you go and find some template that's generated somewhere else Usually in core and you copy it into your theme and you change it a little bit And this makes most front-end developers really grumpy because they don't want to work within the finds of that existing template They want to write their own template. They want to write their own markup from scratch But then what happens is you don't know what variables to put in it, right? So then you have to go dig around in Drupal and figure out what the variables are and put them in but if we could give you a list of Here are the 16 variables you're gonna need to put into your node template and you could write your template and Feed it into your Drupal site drop it into your theme Like for example, you're doing a layout for a page and you put your block one on the top and block two on the bottom And block three in the footer or however you want it in your content in the middle of the page If you if your site could read that template file It could write configurations based on your template file that position those blocks in those places for you So we have the ability to do that now. We just don't have any code that does it So it's just the kind of thing where you know, you could do the same thing with the field UI Right if you're doing a node template and you're laying out the way your nodes should appear you say, okay well these fields go in this order your Website can read that in and write a config file for the order of those fields So it's just a new way to build Drupal sites in theory But we don't we don't have anyone working on it right now It's just something that I feel like if we had that No one would ever want to theme anything else So so that just gave me an idea so anyone that wants to start on that Would need to write a little trick extension and which Would kind of be in symphony. We have sub requests and Drupal We don't have some but that doesn't mean we can't emulate something like that So we would kind of have something like a render function again Like and then I want to render a block with a block ID that could at this point already work Because what we can do in trick is we can because we know the syntax and we can pass the syntax We can kind of collect all rendered things by Parting the template once without rendering anything then we collect everything Doing our block list and we have a dynamic region. So it could work not only in theory, but also in practice Thank you, thank you Is it possible? Yes, there's actually a Drupal 7 module that does that already that provides a input filter for text filter That uses its way syntax It's not anything that we're focused on in in Drupal 8 because we're working on actually the theme system using twig Not the content. It's self-using twig, but it's definitely possible and there are people already doing it This is probably gonna come off as a little bit of a straw man But I do get how amazing the new twig Templating system is for Drupal 8 and I get why I would want to use it and why it's so fantastic It really is I mean that quite sincerely But I've built and maintained maintain a lot of sites in various older versions of Drupal Especially seven and they all have these old themes running on them and My question is of course this seems like it's gonna be a lot of work that I have to go in and convert Every single one of these themes over To twig and I'm wondering if there isn't a way that could save me a lot of work on that So if you come to the lab tomorrow, we will actually have a demonstration how Hardcore nerds through their terminal, you know that that thing that's black only with green text on Yeah, I'm beginning to learn what it is. It took me some time. There's a magic thing you can do You can twigify your old Be it's be tempted theme and it will keep you magically done There will maybe be a demo of that tomorrow. No, there actually will be and it's pretty amazing Wow Great question Anyone else All right, and finally before you head out or if you just want to stay in chat We are to tell you to take a survey I am we're not sure if it's working I guess try later. Maybe but tell us how we did Hopefully learn some new things and learn about the new toys that you're gonna get Treat about it. Have fun. Yeah