How to wire up a Twig template to a render array
Chapters
- 15:04Welcome to Drupal 8 Developer Prep
- 27:39Building a Simple Drupal 8 Module
- 2:42How to set up basic module scaffolding in Drupal 8
- 3:21How a .info.yml file works, the purpose of using YAML and what the 'type' attribute is for
- 5:27Adding a hook_page_alter() and hook_form_alter() to our module
- 6:16How to add a page programmatically with a module
- 1:02A brief comparison to adding a page programmatically in Drupal 7
- 2:05Reviewing the code in our Controller class file
- 2:51Reviewing the code in our routing.yml file
- 1:27Reviewing our hook_menu() code
- 2:28Overview of what we're about to cover (OOP, autoloading, namespaces and Symfony)
- 91:04Object Oriented Programming Basics
- 4:26The difference between procedural and object-oriented programming
- 3:21Setting up an examples folder and demoing our contact form script
- 3:26Walkthrough of our procedural code example, part 1 (outline of the code)
- 6:08Walkthrough of our procedural code example, part 2 (building the form)
- 4:46Walkthrough of our procedural code example, part 3 (processing the form)
- 1:45How to derive objects from procedural code
- 4:45How classes are structured, what methods and properties are, and how a constructor works
- 1:14How to name classes and methods according to both Drupal and general standards
- 2:31How a class structure makes the relationship between methods explicit
- 5:04What instantiation means, the difference between class and object, and the advantage of properties
- 2:53Reviewing the rest of our code after moving functions into class methods
- 3:02Review of the advantages of object-oriented programming that we've covered so far
- 2:16How the Agile phiolosophy will help you stay sane when figuring out how to structure a project
- 2:07How to decide when to re-factor your code, or split classes into smaller classes
- 1:43A summary of staying sane with OOP, and our use case for re-factoring
- 5:21How and why to use static methods in classes
- 5:09Refactoring to add a new "Builder" class, and how to decide when to use a static method
- 3:41What a "controller" is, and how to implement one in our code
- 3:51How to inherit methods and properties from another class
- 2:18How inheritance allows for abstraction of concepts, and how that can make code difficult to understand
- 4:36How to use an "interface" for defining inherited class structure
- 3:20How and why to use an abstract class
- 3:28What a public interface or API really is and how OOP helps make an API more explicit
- 4:07The difference between the "public", "private" and "protected" visibility settings
- 4:43How to split a single large file into individual class files
- 1:03How to name class files
- 43:45Namespacing and Autoloading in PHP
- 3:03How using third-party libraries or working on a team can create naming conflicts
- 7:11How to use namespaces in PHP
- 2:34How to use namespaces to avoid naming conflicts
- 1:14How to use namespace aliases with the "as" keyword
- 1:32How to use a Fully Qualified Name for classes and methods
- 1:58The benefits of namespacing and a summary of how namespaces work
- 2:12What "autoloading" is and how namespacing relates to it
- 2:24How to create a simple autoloader
- 2:02Walking through our simple autoloader with a debugger
- 3:12How a typical PHP library will be structured and what each of the nested folders mean
- 1:32What FIG (Framework Interoperability Group) is and why PSR-0 (PHP Standards Recommendation) exists
- 8:43How to build a PSR-0 compliant autoloader, and a walkthrough of PSR-0 requirements
- 1:24Why it's good to use an established autoloader instead of creating your own
- 4:44How to make our own project PSR-0 compatible
- 19:50How to use Composer and Packagist
- 1:39How Composer and Packagist work together to help manage reusable PHP components
- 3:13How to install Composer on a Mac or Linux and what a .phar file is
- 1:23How to install Composer in Windows
- 2:21How to set up our Composer example folder and set up a basic Composer project
- 1:31How JSON (JavaScript Object Notation) and our composer.json file work
- 1:25What Semantic Versioning is and how to use it
- 2:55What happens during 'composer install' and how the download is structured
- 1:56How to use Composer's autoloader and use a package in our code
- 1:39A quick look at how Drupal 8 uses Composer
- 1:48How to look for packages, and how Packagist is like a module repository for PHP
- 105:35How to Work With Symfony Components
- 2:41What Symfony is and the difference between a CMS and a framework
- 3:19Building a simple example script and illustrating its flaws
- 5:21Refactoring our code, and how character encoding works
- 5:00How to incorporate the Http Foundation Symfony component to add object orientation to our simple script
- 3:18How the Request and Response classes work
- 1:56Why using global variables is dangerous, and how Http Foundation solves this problem and allows for extending functionality
- 7:04Examples of how we can use the Request class to access variables, and what a reverse proxy is
- 3:04Examples of using the Response class to set status codes, content and content type headers
- 3:37Adding a second page and an include file for common code
- 4:07How to add a front controller
- 2:21Adjusting our pages to use the front controller, and how to add new pages
- 2:47Reorganizing our page files to make it easier to add new pages
- 3:38How to convert a PHP file into a template
- 5:16How to use the extract() function to convert an array to string variables to use in a template
- 3:04The weaknesses of our current routing strategy, how to update a Composer project and set up the routing component
- 3:23How to set up a file to store our routes and use the routing component
- 2:37Updating our front controller to use the routing component
- 3:04How a try ... catch block works and why you would want to use it
- 5:27An in-depth look at how to use try ... catch and throwing exceptions
- 4:12How to use the routing component to generate URLs based on route name, and exploring additional methods of the Matcher class
- 5:16How to convert our pages to use a controller function
- 3:23Updating our routes to include a '_controller' attribute, and what a 'closure' or 'anonymous function’ is
- 2:55Replacing our app with one that calculates leap years
- 2:47How to create a controller class, and how to tell what are valid PHP callbacks
- 3:32How to use the controller resolver and install the Http Kernel component
- 2:59Updating our routes and controller to use the controller resolver, and how type hinting works
- 2:11How we can use multiple front controllers for different environments
- 2:55Creating a reusable Framework class
- 0:53Simplifying our front controller while leveraging our Framework class
- 0:57One minute of reassurance
- 2:31How to add Composer autoloading for our custom code by making it PSR-0 compatible
- 112:37How to Work With Symfony Components, Part 2
- 4:05How to split up our leap year code into a controller class and a model class
- 2:33Adding PSR-0 compatibility to our leap year code, and updating our app.php file
- 1:43What unit testing is and how it can make your code better and more flexible
- 3:11The difference between unit testing, functional testing and regression testing
- 2:25How to install PHPUnit on a Mac or Linux
- 5:09How to install PHPUnit on a Windows machine, what PEAR is and how it compares with Packagist
- 2:40How to set up PHPUnit configuration and set up our first unit tests
- 3:57How setting up interfaces for your classes helps with unit testing
- 2:05What dependency injection is, and updating our framework to use interfaces
- 2:28Looking at how our test and assertion actually work, and where to find out which assertions we can use
- 2:29Adding additional PHPUnit tests for our controller and 500 errors
- 2:29What the Event Dispatcher Symfony component does, and how to add it to our project
- 3:58How to add an event with the Event Dispatcher
- 2:18How to create an event class for our event
- 4:26How to add a listener with our event dispatcher
- 2:49A recap of how we set up our event dispatcher and listener
- 2:51Adding a second listener and setting its priority
- 4:06How to create a class for an event listener
- 2:03Reviewing the code in our event listener classes
- 2:09How a subscriber is different than a listener, and what a 'code smell’ is
- 3:41How to add a subscriber to our event dispatcher
- 1:47Overview of what we covered around the event dispatcher
- 6:29How to add caching support to our framework and controllers
- 4:34How to use the Http Kernel component to replace our entire framework
- 1:00The difference between setter injection and constructor injection
- 3:28How to add custom error reporting to our framework
- 5:45How to create a subscriber that allows controllers to return strings instead of response objects
- 3:17Reducing our front controller code by moving it to our Framework class
- 3:07The disadvantage of instantiating objects inside our framework and how a dependency injection container can help
- 5:29How to create and use a dependency injection container, and what a singleton pattern is
- 3:26How to prepare objects in the dependency injection container with parameters and methods
- 0:54Why you should never use a dependency injection container within a class even though it's tempting
- 1:04Updating our framework code to leverage the dependency injection container
- 2:46How to use dependency injection container properties to store settings
- 5:56An overview of what we learned in these Symfony videos
- 18:16Updating Our Environment and Using PHPStorm
- 1:55Overview of how we will prepare for the next Drupal 8 videos
- 4:19How to install Drupal 8 Alpha 12 with Dev Desktop 2 Beta
- 1:20How to create a Drupal-based project in PHPStorm
- 2:36The benefits of using PHPStorm for an IDE for Drupal work
- 4:47The benefits of using PHPStorm for general development
- 3:19How to get our example folder set up
- 44:54How to Use YAML
- 0:59Why we are going to do a deep dive into YAML
- 6:21How to create a YAML file for routes
- 5:27How to parse a routing YAML file
- 3:56How to parse generic YAML files and setting up our YAML syntax examples
- 6:20Overview of YAML syntax, part 1 - Simple arrays and variable types
- 5:08Overview of YAML syntax, part 2 - Associative and nested arrays
- 5:42What "Separation of Concerns" means and how it applies to YAML and code
- 6:33How to convert our dependency injector container into a services YAML file
- 3:43How to load services into a dependency injector container with a YAML file
- 0:45How to make sure you're loading the right files in your project
- 18:10How the Dependency Injection Container Works in Drupal 8
- 1:15How the dependency injection container acts like a backbone to Drupal 8
- 2:35Taking at look at our our first Drupal 8 services.yml file
- 5:09How to find the dependency injection container in Drupal 8, and an overview of how it is structured
- 5:25How the dependency injection container accesses its services
- 3:46How to figure out what code to use to call a service
- 50:51Working With Symfony Components in Drupal 8, Part 1 - Using and Creating Services
- 3:16Setting up our example module scaffolding
- 2:50Why hook_menu() was removed and why Drupal switched to PSR-4 autoloading
- 2:07How Drupal uses PSR-4 autoloading under the hood
- 5:47Adding a page to our example module by using a route and controller
- 3:15How to use services in a custom module
- 3:54How to find out which class is responsible for a service
- 4:15How to create a service with a custom module
- 1:55How to call our custom service
- 5:05An overview of why we should use services instead of simple functions or classes
- 1:19The differences and similarities between subscribers and hooks
- 3:39How to find an example subscriber class, and an overview of its structure
- 4:03How to find out what events we can subscribe to
- 3:37How to create a subscriber class
- 4:13How to register a subscriber as a service
- 1:36How to figure out what objects and methods we have to work with in a subscriber
- 43:16Working With Symfony Components in Drupal 8, Part 2 - Creating Events and Sub-Requests
- 3:37How to get the route name for the current page and how “inheritdoc” works
- 4:02How to fix a "Class not found" error in Drupal 8
- 6:24How to perform a redirect and how hook_init() has been replaced
- 2:33Why you might choose to create events instead of hooks
- 5:29How to create a custom event quickly with the GenericEvent class
- 2:35How to subscribe to a custom event
- 5:04How to create a specialized custom event class
- 0:46A final word on what we’ve learned about events
- 6:05How to override an existing service
- 0:53The benefits of using an interface for a service
- 2:31Overview of what we've covered, and how we're going to use the HTTP Kernel component to create sub-requests
- 3:17How to create a subrequest with the HTTP Kernel service
- 49:27Upgrading a Module to Drupal 8, Part 1 - Plugins, Annotations and Subscribers
- 2:47The three groups of knowledge that you need to work with Drupal 8 effectively
- 2:55A tour of our Drupal 7 module's front-end feature set
- 5:03A tour of our Drupal 7 module's code base, part 1
- 3:26A tour of our Drupal 7 module's code base, part 2
- 1:38Getting our module to upgrade set up, and running into our first upgrade problem
- 3:47Overview of resources to use when upgrading a module to Drupal 8
- 3:37How to upgrade a .info file to a .info.yml file and install our module
- 1:22How to find a good source in the user interface for an example block
- 2:20How to find a piece of code by searching for a unique string from the interface
- 1:43How a block plugin class is structured
- 2:11What annotations are and how they work
- 2:11Overview of the alternatives to annotations, and why we're not using them
- 1:41A brief description of what a Drupal plugin is
- 2:47How to troubleshoot overlays not showing and how blocks are now actually block factories
- 4:46How to create a block plugin
- 3:14How to modify the default caching settings for a block plugin
- 3:59How to move our hook_init() code into a subscriber
- 74:58Upgrading a Module to Drupal 8, Part 2 - State API, Configuration API, Forms and Blocks
- 2:37A comparison of the State API and the Configuration API and how they replace variable_get()
- 2:07How to use the State API to store arbitrary values
- 0:55How to replace variable_get() with a State API call
- 2:40How to replace drupal_get_title() with a call to the "title resolver" service
- 1:23How to replace variable_set() with a State API call
- 3:40How to replace the $_GET['q'] and what to do when getting a "Drupal class not found" error
- 1:03How to replace variable_del() with a State API call
- 4:31How to upgrade hook_block_view() and format_interval()
- 3:21Overview of the pieces we need for our module configuration form, and finding a good example
- 2:07How forms are structured in Drupal 8
- 5:25Removing unnecessary overrides and upgrading drupal_map_asscoc()
- 4:18How to use the Configuration API to store default module settings, replacing variable_set()
- 1:23How to update configuration with the Configuration API and submitting a module settings form
- 4:44How to add a page for our module configuration form
- 1:14How to get our default configuration value to register while doing development
- 0:34Which files to use if you're starting this series from here
- 5:03How to register a menu link and find the ID for an existing menu link
- 1:13How to show a link to our module configuration form from the module listing page
- 5:27How to set up a block configuration form, and a benefit of using plugins
- 3:35How to use block settings in a block configuration form
- 1:48How to use the Configuration API as a service
- 1:32Testing out our module settings and troubleshooting a problem with saving the value
- 3:35Troubleshooting our block configuration form
- 1:24Adding a second block and ways to improve our block configuration
- 5:32Updating our .module file's hook_permission() and hook_help()
- 2:34Cleaning up our .module file and updating hook_cron()
- 1:13How to fix an "Undefined offset" error
- 32:12Using the Twig template engine in Drupal 8
- 2:51Overview of how Twig works and why Twig is so useful
- 3:43How to set up a Twig template file and a brief description of Twig variables
- 2:50How to register a Twig template file with hook_theme()
- 2:16How to wire up a Twig template to a render array
- 2:08How to easily debug Twig templates by reloading updated template files automatically
- 2:52How to use Twig filters and translate content in a template with the t filter
- 1:16How to replace variables in a translated string using the "t" filter in a Twig template
- 2:04How to set up a new variable to use in our Twig template file
- 2:31How to decide how granular a template file should be
- 1:50How to see what variables you have to work with in a Twig template using "dump"
- 3:08How to do a foreach loop in a Twig template
- 0:52How to use the dump tool in Twig to see just the names of the available variables
- 1:38How to figure out what Twig template file is responsible for any output on the page
- 2:13Congratulations and a quick review of what we covered in this course