In this tutorial, we'll begin to wire up an AJAX call to an API endpoint. Along the way, we'll learn how to include page-specific JavaScript assets.
In this tutorial, we'll learn how to wire up our app to send and receive data to/from an API endpoint.
Additional resources
- [JavaScript topic page](https://drupalize.me/topic/javascript)
Symfony 4: Services
FreeIn this tutorial, we'll learn about useful objects in Symfony known as services.
The command line can be a scary place for someone not familiar with interacting with a computer through text-only. We are so used to using GUIs to point and click our way through tasks. In this series we'll walk through some of the most common command line tasks to help you understand what is going on and be able to do some cool tricks yourself.
This is the first video in a series that shows basic command line usage for *nix systems, such as Linux, Mac OS X, and on Windows, using applications like Cygwin. This video shows the following commands and spends the most time explaining how to move around your file structure from the command line:
- pwd
- ls (and ls -al)
- less
- cd
- man
- clear
Note: this video was originally released August 31, 2009 on Lullabot.com.
The second video in the command line basics series, this one covers common commands for dealing with files; copying, moving and deleting them. We walk through examples for the following commands: cp, mv, and rm.
Just a a fair warning that I say the word "stuff" way too many times in this video. Please just bear with it.
Note: this video was originally released September 8, 2009 on Lullabot.com.
In this next video of our command line series, we will look at permissions and ownership of files and folders - how to understand the information you see and change it. It covers the following commands:
- chmod
- chown
- chgrp
- sudo
Note: this video was originally released September 16, 2009 on Lullabot.com.
This command line video covers the three most common commands for compressing and archiving files, including how to get them back out again. Most commonly you first hit the need for these when you download a file and need to get it uncompressed. We'll cover the following commands:
- zip
- unzip
- gzip
- gunzip
- tar
Note: this video was originally released October 28, 2009 on Lullabot.com.
This video shows how to use the magical symbolic link, or symlink. These are basically a handy *nix way to create shortcuts. They come in particularly handy if you want to organize code for your websites outside of the web server's document root and that is the example we use here.
Note: this video was originally released November 23, 2009 on Lullabot.com.
Using SSH and SCP
FreeIn this video you'll see how simple it is to connect to a remote server using SSH (secure shell). We'll also look at how you can quickly and securely copy files from a remote server using the SCP command (secure copy). These are both invaluable tools when working with servers that you don't have physical access to. Note: this video was originally released April 8, 2010 on Lullabot.com.
In this video we'll look at two ways of finding files from the command line. We'll use both locate (and its friend updatedb) and find, and talk about the differences between them.
Note: this video was originally released June 8, 2010 on Lullabot.com.
This video in the command line series will get you started using the very powerful grep command. This is one of the most used commands, especially if you are working with a lot of text (like code, for instance). Grep will let you search through files to find strings and it's great for tracking down where something is coming from. Grep is a very powerful tool with lots of options, but you'll see you can do a lot even with just the basics. We cover the basic command with a file, how to use it through directories, and then we use a few of the most popular options:
-r Recurse
-n Line Number
-l List
-v Reverse
-i Ignore Case
Note: this video was originally released June 22, 2010 on Lullabot.com.
This video introduces you to the Vi (and Vim) editor. Vi is the most common text editor that you will have available to you on *nix systems so it pays to at least learn the basics in case you end up somewhere where that is all you have to use. Vim is also actually a very serviceable editor which many people (mostly hardcore geeks) use as their day to day editor. We'll talk briefly about Vi versus Vim, then open a file, move around, and close the the file. Our next video will dive more into editing files with Vi.
Note: There are a lot of editors out there on various systems, notably emacs, nano, and pico. Vi is considered the lowest common denominator (i.e. it is the most commonly available one), which is why it is the one being covered in the command line basics series. It is also the editor that I use personally, so is the one I am most familiar with. Please limit editor war discussions to other threads on the internet that are meant for them.
Note: this video was originally released July 27, 2010 on Lullabot.com.
Note: In some places the command line prompt is cut-off. The YouTube version of this video doesn't have the cut-off problem. We are working on getting this fixed, but in the meantime, check out the YouTube version instead.
Command Line Basics 9: Introduction to Vi/Vim editor (youtube.com)
In this second Vi/Vim video we move on to doing some basic editing (see the Intro to Vi/Vim video for an overview). We cover inserting text in a few different ways, how to delete text, and then how to revert or save your changes. Note: this video was originally released August 9, 2010 on Lullabot.com.
Note: In some places the command line prompt is cut-off. The YouTube version of this video doesn't have the cut-off problem. We are working on getting this fixed, but in the meantime, check out the YouTube version instead.
Command Line Basics 10: Editing with Vi/Vim editor (youtube.com)
This video picks up where we left off in the Editing with Vi/Vim video. This time we take a look at some shortcuts for replacing text, how to copy/paste, and the cool visual mode feature you get with Vim Note: this video was originally released August 31, 2010 on Lullabot.com.
Note: In some places the command line prompt is cut-off. The YouTube version of this video doesn't have the cut-off problem. We are working on getting this fixed, but in the meantime, check out the YouTube version instead.
Command Line Basics 11: More Editing with Vi/Vim editor (youtube.com)
AJAX is one of the main reasons to use a Javascript library such as jQuery. See how simple it is to perform a previously difficult task that required complex browser specific code to preform reliably and was prone to simple mistakes. Implement basic AJAX requests using jQuery's built in methods which make it extremely simple to send an asynchronous request to a server, gather the returned data, and insert it into the page.
Example code:
// AJAX Live Function
$('.content p').live('mouseenter mouseleave',
function() {
$(this).toggleClass('hilight');
}
);
// AJAX Example
$('.node_read_more a').click(function() {
var url = $(this).attr('href');
var link = this;
$.ajax({
url: url,
success: function(data) {
var $fullContent = $('#content-output .content', data);
var html = $fullContent.html();
$(link).closest('div.node').find('div.content').html(html);
$(link).hide();
}
});
return false;
});
In its short history, jQuery has revolutionized front-end web development, making it faster, easier, and more rewarding to write JavaScript – allowing easier selection and manipulation of HTML elements, and ensuring that scripts work across the ever increasing landscape of browsers and operating systems.
Nate Haug and Jeff Robbins show many hands-on examples demonstrating how to use jQuery's simple syntax to choose and manipulate HTML elements, traverse the document object model (DOM), and to attach event handlers which can react to user interaction with the page.
In this video, Jeff and Nate introduce themselves and the agenda for this series, including Selectors, Effects, and AJAX.
Twig is the theme template engine in Drupal as of version 8. Like any code, there are guidelines and standards that dictate both the style and the structure of the code. In this tutorial we will explain how to adhere to the Drupal code standards while implementing Twig templating.
By the end of this tutorial you will be able to adhere to Drupal's coding standards when writing Twig, and know where to find more information about the guidelines when necessary.
Managing a Drupal application with Composer requires a few modifications to Composer's default behavior. For instance, Drupal expects that specialized packages called "modules" be downloaded to modules/contrib rather than Composer's default vendor directory.
Additionally, it is common practice in the Drupal community to modify contributed projects with patches from Drupal.org. How do we incorporate Drupal-specific practices like these into a Composer workflow?
In this tutorial we will:
- Address all of the Drupal-specific configuration necessary to manage a Drupal application using Composer
By the end of this tutorial you should know how to configure Composer to work with Drupal, and drupal.org.
When managing your Drupal project with Composer you'll use Composer commands to download (require) modules and themes that you want to install, as well as issuing commands to keep those modules and themes up-to-date when new versions are released.
In this tutorial we'll:
- Cover step-by-step instructions for performing common Composer tasks for a Drupal application
- Install and update Drupal projects (core, modules, themes, profiles, etc.) using Composer
- Convert an existing application to use Composer
By the end of this tutorial you should know how to use Composer to install, and update, Drupal modules and themes.
Just like PHP or JavaScript, Twig has functions that can be used once we’re inside either a Twig delimiter. To see the built-in functions, check out the bottom of the Twig documentation page. In your application, especially if you’re using Twig inside something like Symfony or Drupal, you may have even more functions available to you. Fortunately, the syntax to use a function is always the same: just check out your project’s documentation to see what other goodies you have. In this tutorial, you will start using Twig functions and filters to get the length of a collection in our demo site. We'll also play around with the dump
function to see how we can go about debugging Twig.