As a New America Foundation sports fellow, I'm going to be working on online education and how it's reshaping the American political landscape. Obviously online education is kind of a sexy topic, but it's also wonky. It also has a little bit of a boring internet kids' sleep at their desk's angle. So what I'm hoping to do is write about the ways that policymakers are addressing the changes that online education is bringing to education and also how it's changing public schools. One thing that got me interested in online education is my own experience with some online courses. These are just little teeny online courses that are used for professional education or other things that you associate with kind of grownups. So a little unit on how to learn how to do accounting or an ethics course for the New York Times, something that I did when I worked there to many years ago. But it's far more interesting to see what happens when online education trickles down for kids. Right now I have a year and a half year old daughter and she's great on my iPhone.  So one reason that I'm interested in online education is for my own children, for my own daughter, to see what her classroom experience will be like and how it will be different from mine. But I'm also interested in it from a public policy perspective. American schools are in trouble. They're really a mess right now. And I think online education can be much more than an add-on. I think it could be a way to rethink, start over and really solve some of the problems with education in this country. Now I actually think that computers will replace teachers in many instances. I think that we're seeing huge budget crunches on the state level. States are having trouble paying teachers. And a lot of the discussion about online education is very careful to say, well there's still a place for people, right? We're not talking about the Jetsons here. We're not talking about Rosie the Robot delivering lessons to the kids. But I actually think we hopefully are talking about the Jetsons a little bit. We hopefully are seeing a future where certainly there's still a role for human beings in education. Certainly there's still a role for teachers. But there are a lot of things that a computer or a computer with humans on the other end of the line, on the other end of the email, on the other end of the chat program, can do better than a human in the classroom.


gotta reorganize here. So let me put these on the plate carrier. It's slippery. So this is all it hit my eye. Hello everybody and welcome back to another tactical ASMR video. So today's video is pretty awesome because I'm unboxing all of this and it's pretty much all brand new Macs. So welcome and enjoy this tactical unboxing. So these are all brand new Macs okay and they're pistol magazines and they're also rifle magazines for my rifles. So I'm just gonna pick one out and show you what it is. This right here is the ETS magazine for Glock and it's compatible with aftermarket floor plates. Okay this fits the Glock 17, the 18, 19, 19x, 26, 34 and 45 and these just so you guys know disclaimer ETS or Elite Tactical Systems did send out these Macs for review for the next little bit on the channel and I really pumped to go try these out at the range and see how durable they are and how they react to the heat or the cold and the way that I train on the range. So this is impact resistant, extreme impact resistant, chemical resistant, UV resistant and yeah it's got a lifetime warranty. So let's open one of these up and see how it feels. So like first impressions right off the bat, I like how they feel. I mean this is a pretty good grip here. Gotta try it out on the uh oh just so you guys know this is uh clear, safe and empty. That feels, feels really good and the fact that it's not. I like when I press the ejection it comes out right away and it's secure. It feels really good. So this is the uh like the smoky color way. I've no actually no. Oh I think it is because I got smoky and clear and I like it. So this is the Glock 17 magazine and of course these are made in the USA. So let me put this over here. Those are really good. Like you can tell this is well made, well built. Well here let's unbox another one and see what that's like. Let me grab this one. This one is the this one's the 19 round capacity magazine. So and this one's going to be I believe more of the smoky black look. So this is the 19 round magazine and as you can see it is quite long and quite large. Look at that. The 19, 19 round magazine. That feels so good. Like I am very impressed by these ETS magazines already. Oh man we're gonna have some fun. That's for sure. That is that's for sure. Plate carrier up here. Oh this one here too. It looks pretty crazy. I don't know if you can see it. Look at this. Isn't that crazy? This one here is a 31 round magazine and it's orange and it looks awesome. That looks so nice. I love that look. Can you see it? Oh let me focus on it. It's so red. I like that a lot. It does fit really well. I'm gonna put it on. It just goes a rifle magazine here. Yeah that feels pretty strong. That feels pretty secure. I love that it's got a nice grip at the end here. If you guys can see this end like all these ridges here will definitely help when you try to, sorry when you try to grab the magazine definitely does help to have these ridges and something to hold on to because with other magazines you know it can tend to slip but I do like this feature here. You can see it. There's a 556 round imprint at the bottom which is actually pretty neat. So I'll put it on my magazine. Oh man I'm digging this. This is gonna be quite sounds good. It feels good. I can't imagine just putting this in my rifle. I do like this a lot man. This is pretty great in my plate carrier for you guys. Also I will have these magazines linked down below in the description if you want to check them out. One more 30 round magazine. New magazines. There's wrappers out of the way. Oh I appreciate the package like it's nice and bright. It's informative and on the back here they give you the benefits as to the advanced polymer benefits. Extreme impact resistance won't crack or break when dropped. Very resistant to harsh chemicals. Superior heat, cold and UV resistant will become brittle over time when even exposed to harsh environments or cold. Translucent body allowing you to see your ammo count and type. Creep resistant. The feed lips and body won't spread when being stored long term even when fully loaded. So I like that clear look. Here's another one. Let me take my third. This is either the new mags that I'm going to be rocking. ETS advanced magazines. This is the clear and I'm pretty excited to be running these to be honest just because they do feel like a really great build quality and I very much appreciate that. Got to reorganize here. So let me put these on the plate carrier. It's slippery. So this is all a new ETS magazines. Check this out. My favorite. So they got stickers, cool stickers and stickers, stickers, patches. We got some new patches we can put on the plate carrier. But will it pass the patch tap test? It hit my eye. I think it will. Brand new mags, brand new patches on the plate carrier and look at that. It's so big. Look at this thing. Huge, massive. I love it. We'll be taking all these out to the range very soon and we're actually moving. So I'm in the middle of moving all my stuff to a different house. So once all that stuff is done, I'll be going to the range and testing all these magazines to ensure that they do function and that they do fit in my everyday needs. And like I said, if you want to check these out, I'll link them down in the description below. So thanks for watching guys and I'll catch you in the next tactical ASMR.


Okay, good good evening everyone and thanks for coming to this session about tweak and Drupal Let me first obviously introduce myself. My name is Javier. I work for this company called sensual apps Which is the company that created both symphony and tweak and many other open source projects Which obviously are the main new technologies behind Drupal 8? About this talk we won't talk about tweak basics Okay, and we won't either talk about all the low-level technical details of everything We're going to show but don't worry because the tweak documentation is really excellent So all the details are there so you won't get close on in real life. Okay Okay, group and tweak To it has a lot of great features. That's why you can use choose to use this To begin template engine like secure fast easy to learn But to me the main the best feature of of tweak is that it's very consistent in two ways The first one is that tweak defines a very very small set of features. So it's really easy to learn There are people concerned about hey I know PHP and now I need to learn a new type plate engine and okay It's going to be very very easy to learn. Okay, don't worry and Even if it's a very small set of features is enough to create any kind of template of any level of complexity Okay, and the syntax is very consistent since they want it hasn't changed in in any way Even if they are key and adding new features continuously. It hasn't changed Okay So that's why I think using tweak templates is the decision Drupal ever made. I know that it sounds like wow, but I'm really Confident about this However, if you see all the tweak features, which are a lot Drupal 8 at least the built-in themes Only use like the 30% or less of the tick features Okay I'm very disappointed looking at the built-in templates so far They are not really using all the great features of tweak and it's sad because Drupal is great tweak is great If both work together they could do really amazing things So we're going to see several things related to tweak a lot of features. So We don't have many times. So let's start With the first block which is accessing variables, okay For each block on the first slide will be this one. Why is this important? Why do you have to know this in this case? You can improve the Application performance a lot if you do this, okay If you want to output a simple variable like this one, this is a real example from real Drupal 8 template Okay, you output a simple variable nothing Nothing strange happens. It doesn't output the value on that's that's all But if you output a complex variable, which is which are these ones which contains that dot Here the tweak magic happens When you put this in a template tweak tries to do all of these to get the real value So links could be a key of a content array Or it could be a method or a property or a getter or a iser Okay, tweak tries all of these in this order and the first one that exists is Using the template. Okay, so it's great for the template. You don't have to change the template if the application change but obviously Regarding performance this has some impact, okay So especially for Drupal, I mean your Templates are going to be very complex. We are going to access a lot of variables. So these matters this Performance penalty. So to provide a solution for this is a PHP extension Which it doesn't really do anything else but resolving The variable logic, okay all these resolving magic stuff is done in the PHP extension So you can get just by installing the PHP extension Just a at least 15% performance increase in your website or your application Okay, so you should really install this PHP extension And the last thing about variables is that some of the Drupal variables are Wrongly named like the markup here if you put that tweak is not going to work Okay, because of that character. So you you've seen a lot of Drupal templates this alternative way of Doing things. Okay, but the natural thing is using the dot that's the way to do Sometimes you can do that in Drupal. Okay, defensive programming. This block is about is about Since sooner or later errors will happen in your application in your website What really matters is what you do with that error happens. How do you recover from that situation? Okay, so we're going to see several techniques deep spreex First one is dealing with empty or undefined variables. There are a lot of different ways of dealing with this I recommend using these two methods the first one If and the name of the variable Checks if the variable is not known. Okay, not empty for any for a string or a ring not empty and no zero for numbers However, because because it only works if the variable is defined If that variable doesn't exist in the template, you're going to get an error Okay, in the second case this one the default filter. This is always going to work It doesn't matter if the variable is empty. It doesn't exist. It's not defined. It doesn't matter. It's always going to work Okay, so you can combine both like this and this is always going to work no matter what about the the variable And in case you don't know if a variable is defined or not in Drupal 8 this problem should not happen That's why I put that in the slide But just in case if you need to check if the variable really exists or not you should use this check Okay, if variable is defined Of course, there are other specific checks like it's null. It's empty or whatever Okay, second technique for empty collections you have an empty array of elements You can take care of that With this one which obviously in regular PHP. It doesn't exist But here in twig you can use the four L's Which is really really convenient and you can even filter Run elements or elements you don't want to fill to output in the loop with the if close So in PHP you have the four for each do while whatever here You only have the four but you have the four else and the four if else Now avoiding missing templates when you use they include Instruction to include any fragment of twig This is usually going to work. I mean, this is a regular template It's probably defined in your theme the menu dot twig template. So this is gonna work always However, if you do this If you try to include dynamic template This is probably in some cases not going to work because that name is dynamic is variable So probably the template the final template doesn't exist sometimes Okay, so there are two ways to avoid these problems the first one in the include instruction You can provide a collection of templates And they act as fallback Twig tries to load the first one if it doesn't exist try the second one the third one And obviously if none of these exist an error happens. Okay, but The first one that exists is included Okay The other technique Sometimes you cannot really provide fallback templates. Okay, so you can instead of Letting that error happening and the user getting a bad experience seeing an error or in your work on your website You can ignore the missing template. Maybe the user see a blank Section section in the web page or something like that, but it's better than an actual error So you can do this You can tell to it. Hey, if this template doesn't exist ignore the error. Don't include anything Okay, don't trigger an error. Okay now Filters, this is the list of filters defined by Drupal 8 so far. It's not released yet So we we don't really know the final list, but so far This is the the list of filters provided by by Drupal. However Being such a complex project and long-standing project is going to be alive for years Drupal Probably they add and remove some of these filters The problem is that if they remove the filter your Your themes your templates will break. So recently To it has added this new feature when you create a filter you can define your own filters for your own themes You can say hey this filter is now deprecated and the new one you should use instead of this one is Another one. Okay, this is the way to do those breaks in your Applications and in your things. Okay. This is the right way to do things In some applications like symphony these kind of Errors are logged and you can see the message you are using a deprecated filter Please update it as soon as possible and blah blah blah in Drupal still you don't have this information Okay, but probably when through police finally released you will get this log information also, okay? But for now you can see this information Okay, and this Check also important if you use a lot of blocks and you do advanced stuff with your templates You can check if something is a block or not if it's defined as a block or not but This is for a Tweet version which hasn't been released yet case for the next version of to it. This will be a Important because Drupal uses a lot of blocks In the templates, okay quite spaces in this block first. I'm going to say to tell you Please don't care about what the spaces and in the second part I'm going to say hey, please care about what these spaces in some cases. Okay, so First I want you to save time. Okay, this is a tip from being Having by having made the templates for few years with to it Okay, so this is a trick from from experience. Okay, so if you have the following in a quick template the output Obviously will be this one. Okay, obviously because you don't are using you are really not using any tweak feature case pure HTML code But if you do this The output won't be the same you take a look It looks like it's the same but the output will be this one Why because in the tweak template there are these white spaces which are this one This is the green one and this is the orange one. Okay, the problem is the orange space White space which breaks the alignment of the HTML templates That that's the problem Into it. Obviously you can fix this with two alternatives with the spaceless or with the dash To attack, okay But my recommendation is please don't waste your time with this Trying to fix the HTML white spaces and alignment Please don't waste your time Okay, tweak templates should be readable HTML should not I mean you are working with a true templates every day Every single day. That's what you're working on The HTML is going to be sent to the browser minimize compress and it's going to be a mess So don't care about the HTML alignment and weight space and things like that. It's not worth it However, sometimes you need to add I think you need to add some weight spaces Here for example in this real through palette template in my opinion, it has a minor problem, which is this one as You can see the HTML contents and the tweak contents. They are not separated by a white space. They are absolutely close Why do they do this? Obviously because when title attribute is empty the generated HTML, which is the second one is Absolute perfect HTML code and in the first case, obviously it's also correct My recommendation is to always separate HTML and tweak code with a weight space And I know that if title attribute is empty you will end up with a weight space with an extra weight space My recommendation it does not matter at all This is valid HTML valid code. It works perfectly and the tweak template is more readable with that weight space And this case is even more clear again a real through palette template And I think this is a real bad practice As you can see as always the HTML the generated HTML is perfect in both cases if height name exists or not but Here are very very serious problems First you are hiding HTML things like the class attribute inside tweak strings This is very easy to overlook and to make mistakes. This is the first bad practice and the second one is this one Because we want perfect HTML we are doing weird things with the white spaces in tweak This means that if you remove accidentally that weight space All the page design is going to break and you're going to spend several hours trying to see what the problem is And what the CSS and things like that is not working. It's because of that if you remove that weight space You break everything. So I recommend you to do like that This is the in my opinion the best way to do this Obviously when height name doesn't exist you end up with an empty class attribute Which again? It doesn't matter. It works. It's valid. You can check with the official HTML validator. It's absolute valid code So please don't mess with white space in tweak in HTML set. Don't waste your time with this, okay Okay, the next block Hopefully we'll save you a lot of time while developing your template your themes, etc And the first thing I want to tell you is about the tweak configuration This file site slash default slash service dot yml is the way is the place where you can define the tweak behavior in Drupal You can change three things We only care right now about this one debug You said it to true by default is false But you said it to true Drupal is going to add a lot of debug information in the generated HTML Let's see an example. This is the real HTML generated by Drupal by default if you change nothing But if you set debug to true you get this See the difference in the same code But you have a lot more comments which are these ones for each block for its piece of a theme of Template use by by Drupal. You're going to see all the full list of Templates that Drupal tried to load before loading the real template use in that page Okay, so you know exactly which template you should define to override that design of that block of that page of that thing It's very very easy to know what to do with template to create or modify Another thing that is very important while developing themes is to know which variables which information is available in your theme in your pages in your files, okay one great thing that Drupal does is to as you can see add a lot of comments Describing all the variables pass to a template. This is so you always know which variables are in the template, okay, however, if you want a more dynamic way of doing things you can use this special function called dump and If you put that in any template You get this all the variables under contents Available in that template all the information all the variables obviously this is too much Doing the dump Like that so probably you need this dump only the variables you are interested on so if you put Several names you only get those variables Which is much better obviously while debugging and developing the themes the templates, okay As always remember that whenever you change the both the templates and the configuration like the tweak configuration You have to reveal your cache. I I you probably Do it in your own way, but I can recommend you this project Drupal console Which is a great way of controlling your Drupal websites and applications Be at the common console. Okay, so to rebuild the cache for any project You just have to execute this Drupal cache rebuild or the shortcut and that's all Okay, okay, the next block is about escaping Which is very important for secure to avoid security related issues. Okay however before starting Be careful because the Rupa has to replace the default tweak escaping filter and behavior With their own so I don't know if when Drupal is finally released will be the same but for now This is true One of the best things of twig compared with other Temperature engines that it always escapes by default the contents before displaying them Okay, so you have some HTML content inside of a screen and you try to output that screen Maybe you expect it to work it like that But it does not it works like this HTML content is not rendered is displayed as it is Okay by default obviously you can use the raw filter when you are sure that you want to Output HTML you can use that filter to render the real contents. Okay That's obvious to documentation space well However, when you have this Some values some variables on contents inside not HTML, but JavaScript a URL and HTML attribute for instance when you have that you may have problems You're generating an entire JavaScript file with tweak tweak is is smart enough to know that you are using JavaScript And so it doesn't scape like HTML it escapes contents for JavaScript But if you are using like this putting some JavaScript inside HTML Escaping may be wrong Okay, so you can use this filter the e for escape obviously to escape a playing different strategies For instance, I want to escape this value for Including it in a URL it will be the first case all for including it in a JavaScript code Okay, there are several strategies or explaining the documentation obviously, okay, but you should be aware of this Okay, to it does does it the right mostly? But probably you need to tweak some things when doing advanced things like JavaScript and stuff like that. Yeah sorry, okay, I they are talking about filtering and Filters I guess I guess for Drupal 7 version you you mean Okay, it had something like that Okay, but in this case that they are using their own filter called Drupal escape Which do some changes and at the end it uses the tweak one So probably when this release by real the droop a late final version probably they won't use their own Escape filter, but the real one there the tweak the two one you mean the scaping filter or in general the escaping filter you cannot really configure them because I Mean if you want to escape for HTML you cannot configure which character are problematic or not for HTML I mean that's defined and it's like that you cannot really change it doesn't make sense for the spec escape filter for others obviously, yes You can add new escape filters if you need another encoding for whatever Format you are using but these are the they built in the default ones Okay about reducing templates This is obviously going to save you a lot of time and a lot of code and your themes are going to be great if they Reduce a lot of contents, okay? As always there are a lot of different ways of reducing templates and fragments of templates This is probably How often are they used? Okay, I Mean for real web for common web applications. I don't know when Drupal is released. This is What is going to be okay? so we're going to do a quick recap of each one and Recommend you when and when not to use each of them. Okay extends It's very common for websites to share a lot of elements between pages I mean the header the footer the menu the sidebar the main style the CSS That is the JavaScript library is a lot of different elements are exactly the same for all the pages like these ones for the official Drupal code web page all the pages are the same contents obviously changed but All the other things are exactly the same for a page. So quick stops this problem like this He says hey, you can define a complex complete Template with all the common elements header footer menu sidebar, whatever and then all the pages that are exactly like that Can define only the contents only the things that are different from from the layout template for the big complex template Okay, and it's really really easy to do that The layout is a regular HTML and tweak template so you can use everything obviously and the others in the only thing you have to do is this one You need to define blocks which is like holes with which other templates can fill with their contents So you say I open opening a hole for the title because the title will be different from one page One other obviously and for the main body content I'm going to open another hole which other templates will fill in with their contents and it's like that The children templates the templates that use that layout that extends from the layout They only have to define the contents for those holes for those blocks So you don't have to repeat everything for every page for every template Okay, so this obviously is really Use a lot to create the layout of the themes of the websites obviously Okay, and you can also extend in several levels Okay, you only you don't have to have only one layout and then regular pages You can have one base layout then two or three main layouts for different sections and then pages and case very very cool Okay, they include function This is as easy as it looks You have some code that you are using in a lot of templates Well extract that fragment of code no matter how short or long is it extract and save it in another file and then include that file in the templates and that's all as easy as it looks Okay, so to reuse large large fragments like sidebars and things like that is really cool. They include function Macro this is not really Use a lot and it's a shame because you could really save a lot of time and a lot of code if you use this, right? For instance, if you define complex forms, you probably are using this html code and tweak code okay to output All the values set it up for each for few okay This is for the bootstrap CSS framework, but all the other framers are similar. Okay with a with a macro you could do this See it's almost the same the code is exactly the same But you wrap the code with the macro function, okay, and it's like a PHP function you pass some arguments and then function return something in this case it renders the Internal code that you define there. Okay, so now forms can be as easy as this one You can say macro from field and then only the different things between The only strange things in this case is this one import self as macro You have to import macros before using them even if they are defined in the template you are using Okay, it's a bit strange, but it's useful because macros can be defined in a different template Maybe you use a lot of macros well create one tweak file to store all those macros and then import Those macros in your templates. Okay, that's the idea Okay, now the embed again is not used a lot, but it's really really useful especially for Modern websites, which are all of them based on a grid like the bootstrap grid, okay And as you can see for instance in these two pages Use the same three column grid for that row obviously Then one uses the two column grid and the other one again the three column grid But at that both at that point both templates are using exactly the same structure. It's exactly the same grid Okay, and you may think well with the include function, maybe I can solve this problem I mean you create the grid in some file you include it and that's You can't do this because when you include something you include both the structure the HTML tags and things like that And the content of that template you cannot change the content. So obviously this doesn't work You may say hmm, okay include now, but maybe extends I can create a base template and then extend from it and It doesn't really work if your pages are very complex and if they use a lot of grids in a single page three column and then a two column and then no columns and In that case it doesn't work because you cannot extend at the same time from different pages. You cannot do this So the right solution to this problem is this one You define the code again, this is for bootstrap, but it could be whatever For the three column grid And you define three call three blocks, which are the holes which someone has to fill in with contents You define three blocks for the columns and then whenever you need a three column grid You only need to do this. See embed is not include is not extends is something different It's like a combination of both it includes something that I can change their contents before including them so it's really advanced for Grids especially which are as I said very very popular nowadays And the set which is almost the last one is really easy to use it But it's not that common For instance, imagine that in your page you use the you display the navigation two times at the top of a listing and at the end of that listing Instead of repeating that code in two different parts of the same template. You can do this You can Enclose the common HTML code with a set instruction and that creates a variable called like that in this case Navigation and the content of that variable would be all the code enclosed by set and Then you can output like a real like a regular variable. You can output that code as many times as you want So it's not that used but it's very useful for cases like this And the last one is the juice tag, which is really advanced for us for Drupal things So I'm not going to explain it at all. Okay, you can See it as always in the documentation. Okay, but forget for now about this Okay, dynamic templates, this is something that you usually don't use for Normal websites normal applications, but since Drupal is so advanced and you can do so many great things Probably sometimes you may need to do this That's the reason why we see this Okay The first thing about dynamic templates, you can use that function called template front string to do exactly What it looks it creates a real template from the string code that you pass to it So you create some string with tweak code inside and you can create can create on the fly That template and obviously you can include it or do whatever you do with a real template And it even works on extents and bed and everything So this is really really advanced You can do it all in one step like that include template from screen and whatever and Obviously since is a regular stream You can manipulate it before creating the template you can replace things or do whatever you do But with the strings So this is really really advanced and someone related to To this function will be this one Source which gets the source code of the given template without actually rendering it So you can get the source of any template manipulate it and create on the fly the template and include it again and I Know this is not common This is something that you usually don't do but again Drupal is very advanced you have very advanced needs So here the tools that we provide to you Okay, a problem with that site Customization, I mean in this case you have a website with some header footer sidebar, whatever and you let some sections to Customize overwrite some content and design of some parts of that page Like for instance reddit reddit a lot of Reddit can change the contents and the design of the sidebar Header, etc Okay, you can do this in using tweak obviously it's very very easy to do but the problem is that when you are Rendering templates provided by the user that's probably a problem a security issue Why because even if you restrict the the kind of people who can actually create those templates Maybe a special set of editors or publishers or special set of users Even in that case you cannot really trust anything done by users Okay, the template on purpose or not can break everything and it can be a real disaster Okay, so tweak provides this cool thing which is the sandbox Which is a way to Run templates usually made by the users but in a safe way You can be sure that the application is not going to break or there's there's not going to be security issues and things like that Okay, and it's done like this You can sandbox a template with the tag or the argument Okay, and that template in this case sidebar.tweak cannot use all the features available in tweak That template can only use the ones that you define here These are the details that we don't explain. Okay, but you define a white list of methods tags Filters properties that the the sandboxes sandboxes template can access and anything that is not here Won't be available to that template. Okay, so it's a very secure way of including Dynamic things or contents done by users that you can strictly control what they can and cannot do in your application Okay, this is a very short blog, but it's I love it because Working with dates with dates is not that easy sometimes and tweak already provides a lot of features So you can do a lot of things in tweak and forget about PHP Okay Like for instance something like this displaying dates in the time zone of the user. It's as easy as it looks You don't have to transform dates in the PHP code or do whatever you do It's as easy as this Or doing dynamic Comparisons of dates you can say hey if the event hasn't started is unlike this You can buy tickets if not you cannot keep buying tickets You can do this in the template and when they when the data writes that link won't be displayed again So you don't have to do strange things in PHP or things like that. Okay, the template can take care of that And I love this example the date modify filter you can do amazing things like this See you can say hey the early birds ends 15 days before the event start You can display that date like that. You don't have to clone the daytime object in PHP and modify and You can do you can do it like that as easy as as it looks Okay, and to end this session. I'm going to do a quick recap of Some of other tweak features that in my opinion put twig years ahead of PHP Some of them are really really small. Okay Like this one for instance, I know it's very small But it's very very convenient for collection and a race to get the last Element of a collection is like that last Obviously, but in PHP you cannot do this Okay, or this one. I love it this this test it starts with ends with matches the The template that the play code is very very expressive And is great and this is something that you cannot do with PHP in a lot of programming languages You have this starts with and ends with function, but it's not available in PHP In fact, it is rejected by PHP. They propose to add this and they say hey, no we don't like this or this one the in operator. I love it is Multipurpose operator. Okay, you can check if some stream is inside is contained in some of a stream Or if some item variable string whatever is containing some collection Again, this was proposed to PHP But rejected by PHP internals. They say no we don't like the in operator It's sad because it's very very expressive way of doing things in templates And this one name You have this filter they convert encoding filter You have two parameters. It's a filter to convert one encoding to another but my question is Which one is the original? Charged and what and which one is the target one? You don't really know You should check the documentation or the source code is the usual needle haystack haystack problem You don't really know which is the the order Intuit you don't have this problem because all the attributes all the arguments all the parameters of the all the filters and functions Have a name So you can use tweak like that This works perfectly But you can put the name of the argument of the parameter when you use that parameter when you pass that value So now it's clearly which one is the origin chart set and which one is the target is obviously And obviously because you are using the name You can put Those parameters in any order you can skip any of them. You can do great things that obviously in PHP. You cannot Okay This has been proposed several times for PHP, but we'll see in a few years. Maybe they add this feature Okay, and it's great when a function a filter in a function in this case has a lot of arguments because for instance In the first one if you want to change the fourth argument, which is called ignore missing You have to define the first three arguments But in tweak you can do what you see at the at the bottom You can just define the argument you need in this case ignore missing so you can avoid Setting an empty second parameter and empty third parameter Another quick and cool thing about tweak is this one Imagine you have a image gallery very common and you have several rows and each row displays three images Well the HTML code will be something like that again for boost drafts And maybe if you are used to the PHP way of doing things Maybe you do it like this, which is not bad at all I mean with the cool divisible by filter and all of that, but this is a bit ugly code It's the PHP way of doing things you can do it like that in tweak Which is Using the batch filter you see you say tweak. Okay. I have a collection of items I want you to give them to me In groups of three or four or five or two or whatever then tweak gives you a Super collection of three elements and you can do whatever you want with those three elements So it's super clean and easy to understand code Again, you cannot do this easily at least with PHP Another thing another cool thing the short tenary operator if you do this in PHP As you know you should probably know You get an error. This is wrong. This is this doesn't work in tweak You can do this and obviously it works. Okay, so you have again this example setting a class attribute Both work, but I obviously recommend the first one is more readable most short more easy to understand and obviously it works in tweak not in PHP and Almost the last one This cool filter a which combines several PHP functions and which led to Extract elements from a collection or character from stream Very easy as you can see in these examples You can say it's like a sub stream well done and a ray slice well done Okay, it's very very easy and very cool and very easy to understand and to read and to write and to learn This way of doing things. Okay, again, this is available in lots of programming languages like Python for instance But in PHP you cannot do this. It doesn't work and this one probably for each For loop that you use in a template or in the code you would also define an eye variable Temporary variable to get the number the item number and things like that in tweak This is already done for you inside a for loop. You have this special magic variable called loop With all the usual things you need for instance, give me the number of the item Loop dot index stores that information and it starts with the number one which the way humans count But if you want the matching way of counting things you have the index zero and so this is already done for you use it and that's it and This one the the last thing about arguments We said that you can use name arguments with twig which is great Especially when a fight a filter defines a lot of attributes and keeps adding more and more attributes Okay, you can do like this So for tweak it doesn't really matter how many attributes you define and if you add new ones It doesn't matter the template is going to be still cool But for PHP, this is the real PHP code you need to define this filter It's going to be more and more and more complex if you keep adding arguments well You can do is you can do this in recent tweak versions You can do this define a filter as variadic, which means I Don't mind how many attributes how many arguments are you going to pass me any number is okay? Zero or infinite. I don't care all of them are going to be stored in some variable in this case called options And you can access all of them like that that can rate So it doesn't matter how many arguments you define or how many you add or remove everything is gonna work This Thankfully is already available in PHP in PHP 7. I mean not in the current one Okay, but this variadic thing is the new way of doing things in PHP and including you can use it today Okay So to sum up In my opinion using two 10 places the decision Drupal ever made Okay, I don't know if you agree after this session But what I think you agree is that two templates are safe modern consistent beautiful and Obviously Drupal 8 templates are that too, okay? So they are already a lot of great Drupal 8 things Already done and available to use and I'm sure you are going to do great things with with 3 if you use all the feature that it has So thank you And you have any question you can say it aloud and I repeat or you can use the microphone out there Any question or comment or whatever You tease this at the start of the presentation with the thought that Drupal 8 is only using like 30% of the power of tweak. Can you Tell us what it is that that you would love to see in Drupal 8.1 or where we're a Sort of hundred percent usage of twig the main things and In fact, I would like to see everything used by Drupal because the current in place if you take a look at them they are only using like the if close to to say to see if some variable is defined or not and the way of outputting variables like The simple way of outputting variables they apply some filter sometimes But they don't really use any filter from twig. They don't use any advanced embed thing for instance to create reads and things like that the extents is also not used they use include but nothing else So I really cannot describe all the things that I would like to see because they are almost everything that I Show in this presentation. I mean they are really not using almost anything Okay, thank you. It's really sad. Okay We have another question there about that Which is the level that twig template I Mean the level of functionality that we should use there because you say Drupal uses only if and other easy tasks Which is the highest level we could use on a on a twig template without Having performance issues and sets regarding performance issues apart from the PHP extension which can really improve the The performance all twig templates are cash and transform into PHP code into raw PHP code before executing them. So All the overhead of using and not pure PHP to define the templates is gone Because everything is transformed automatically to PHP. So Obviously the overhead is going to be more than zero. I mean using raw PHP is better for performance But this is very very small performance impact for For two templates, I mean, I don't know for Drupal but for my from my experience from symphony There are huge websites with hundreds of millions of Users and a lot of traffic and everything works right with twig. I mean, it's not incredibly slow Or it's not the problem to it for for huge symphony applications. It's not the problem So you can really use any advanced feature safely It won't break your your application. It won't make it very slow at all and something else different And about Angular and other languages, which is the best practice here to escape brackets and other things Okay, you can define in in twig The brackets that they use to output things or to do things or to common things. They are all configurable I don't know in Drupal Which file you have to change to configure that but you can change the syntax of twig instead of the double Coulee brace, you can use brackets or parentheses or whatever you want to use for twig So it doesn't clash with angular gs, which is more straight and you can change angular So you can change the syntax Obviously don't do it in regular cases, but in these cases with angular it may make sense Okay, any other comment or question? Okay, so thank you again


As someone who shares prophetic words I don't claim to get everything right every single time and sometimes I have a lot more confirmation about specific words than other times. I am not jumping on here claiming to get everything right every single time and the reason is because I'm still human and I am not perfect at hearing from God and also even when I hear very clearly and accurately I'm not perfect at sharing it and interpreting what I've heard and that's just the nature of prophecy. The New Testament talks about how we see in part and we prophesy in part. Anything I share or any other prophetic person shares take it to the Holy Spirit and pray about it you know because people with a prophetic gift are not perfect. You can confirm that something is either from God or the Holy Spirit can say hey they missed God on this one you know if they did or they've got this right but this detail here I want you to ignore. I really encourage you not to just take my word for it when I'm saying this. I encourage you personally to go to the Holy Spirit to go to God's word and to say God what are you saying to me about this? If a person claims to be a prophet and we won't even deal with whether there are prophets today but giving them the benefit out they say that they are a prophet so we should be able to test and see if they are actual prophets. But what he said in the intro was that a prophet is not going to be perfect that's just the nature of prophecy well that's not true. As a matter of fact that's not only not true it's unbiblical it is ungodly it is false and it leads people astray and the Bible tells us what should happen at least in the Old Testament what should happen to a prophet who presumes to speak for the Lord and does so incorrectly so let's go to Deuteronomy 18. You all have heard this passage before but the prophet who speaks a word presumptuously in my name which I have not commanded him to speak or which he speaks in the name of other gods that prophet shall die and so he even equates this person in the same lineage the same line as a person who speaks on behalf of Muhammad a person who speaks on the same line of hinduism or buddhism or an atheist that person who is who is speaking on behalf of another God is the is the equivalent of the person who's giving a false prophecy someone who's speaking or claiming to speak for God for the living God and that person as the Bible says that person shall be should be put to death that now we're not saying the same thing now however there is still a dire warning for that person as well in 2nd Corinthians Paul says this and what I am doing I will continue to do in order to undermine the claims of those who would like to claim that in their boasted mission they work on the same terms as we do now what he's really saying is that there are people who claim to be Christian there are people who claim it's that we're on the same side that I'm a follower of Christ and that isn't the case and so Paul is trying to and is going to continue to expose these people for for who they are and so why does Paul make this statement he says in order to undermine the claim of those who would like to claim that they are on our side he says verse 13 for such men are false apostles deceitful workmen disguising themselves as apostles of Christ and he says and no wonder for even Satan disguises himself as an angel of light so it is no surprise if his servants also disguised themselves as servants of righteousness their end will correspond with their deeds and so this is not a good prognostication for these people they're going to be judged they're going to be dealt with in due course now the Bible tells us in Revelation 12 verse 9 says and the great dragon was thrown down that ancient serpent who is called the devil and Satan who's who's the sever of the world he was thrown down to the earth and his angels were thrown down with him now recall when he was thrown down that serpent where did we hear that word before well in the garden what does uh what does he what does he do the first thing that he does is he tries to distort the word of God did God really say this well here's what God really meant and so you've got these people today following the same line of Satan doing the exact same thing this is what the word of the Lord is this is what God has said that is Satan's chief trick that's his that's his main go-to his strategy and we've got people today that are doing the exact same thing who are trying to tell us that God told them this God told them that and they're wrong and then we've got people like this who would say that even though i've gotten them wrong it's okay i'll keep doing it so when i get on youtube man i get on here and tell God saying when chameleon get on youtube they get on and say what God say when jenny get on youtube they say what God said i'm gonna tell you straight up and i ain't probably try to justify myself i have i have missed it a many times but you know what when i'm gonna keep on speaking until i get it right talk God up and keep speaking till i get it right so no matter how many false prophecies i've given no matter how many false prophecies about this wealth transfer about this about that God told me this God told them i've been wrong here i've been wrong there i've been wrong everywhere and what is his response i'm going to keep doing i'm going to keep doing it until i get it right i'm bound to get it right one day and i can guarantee you this that when he eventually does get one of his predictions right not prophecies but one of his predictions right he is going to claim and tell that as proof that he is a prophet of God but where the Lord was true forgetting the fact that for the last 10 that you've given they all have been incorrect vague and incorrect and this finally you got one right and so now we're supposed to assume that you are a false true prophet now the problem isn't so much that they are false prophets Jesus tells us they're going to come Paul warns us and we're to be alert the problem isn't what they're doing the problem is the people who listen to them and give a pass to what they're doing they'll say things like who are you to judge this person that person's a man of God let's stop dividing the Bible that person's not part of the body a liar someone who lies against christ that is act of the definition of anti christ that person is not part of the body and the sad party is not that we have these people the bible tells us that they're going to come the sad party is we've got people who say they're christians who we're going to have to start questioning their salvation who do not value the word of God but much more value the word of someone who has proven and admitted liar on God they've used God to spread a lie claimed it was God once it's wrong I didn't quite hear it right I'm not going to always get it right well no a prophet is going to be 100% accurate he is going to be perfect in his delivering the word all he has to do is hear from God and then say exactly what he heard then have to write it down just go and say exactly what he heard when he heard it and it's going to be precise and accurate these people are wrong and the problem is we've got a mass of people who follow them who do not care that the word is wrong so the promise is this not from me but from God he says that they're in that they're going to receive their D that is both the people who give these false prophecies and the people who follow after these false prophecies because God has stated that he has tested us to see if we're going to follow after these people and then both parties will be put to judgment and so that's not for me that's from God so if you want a true word from the Lord a real prophecy listen to what the word of God the written word has stated and followed it would be who you to heed his word versus theirs amen