Skip directly to content

Drupal 8

rteijeiro's picture

Drupal 8 Twig template engine

on Wed, 10/16/2013 - 01:06

As you probably know, one of the best new features of Drupal 8 is the new template engine based on Twig and also used by Symfony community.

We will continue improving Bingo module so you can find all example code in the Drupal sandbox for Bingo module. 

There are some changes that make better creating templates for your module pages but other things are still the same. For example we still have hook_theme:

bingo.module

/**
 * Implements hook_theme().
 */
function bingo_theme() {
  return array(
    // Template for list of bingo participants.
    'bingo_list' => array(
      'template' =>
rteijeiro's picture

Forms & Database in Drupal 8

on Thu, 10/03/2013 - 00:24

In the previous post we learnt how to create a menu link to access our forms so now we will learn how to create those forms. For our Bingo module, we will need two forms, one to add participants to the contest and other to delete participants from the contest.

Let's start with the form to add participants. We need to implement \Drupal\Core\Form\FormInterface and override it's methods. You can take a look at all available methods in core/lib/Drupal/Core/Form/FormInterface.php file. The following code implements our AddForm class:

lib/Drupal/bingo/AddForm.php

<?php                              
rteijeiro's picture

First Approach to Drupal 8

on Tue, 09/17/2013 - 01:08

This is my first post about module development for Drupal 8. I will try to demystify that the transition from Drupal 7 to Drupal 8 is hard and painful. Hope you find this posts helpful and you enjoy reading them as I enjoy writing them. Feel free to ask me in the comments but be patience because I receive tons of spam comments ;)

The examples below are based on the Bingo module I have developed for this posts series. You can clone the repository and take a look at the code while you are reading the post.

First of all we should take a look at .info file changes. The .info file now has YAML