Including Part Template

Many themers prefer to keep header / footer codes in a separate file and call the file in page.html.twig

Let's say you have created following file in your theme folder for header.
/THEME_NAME/includes/header.html.twig

And now you want to include this file in page.html.twig

Use below code to include this file.

{% include directory ~ '/includes/header.html.twig' %}

Entity Pilot - content staging for Drupal 8

Installation

  • Download and extract the module
  • Add the php-encryption library using composer or Composer manager.
    • For composer - from your Drupal installation directory run composer require "defuse/php-encryption:~1.2.
    • For Composer manager, refer to its documentation

Getting started

Testing

Finally for some QA. Let's check that our module works as expected by writing a few tests of our own which can be run via Drupal itself.

/src/Tests/LoremIpsumTests.php

Defining a Block

Remember at the beginning of this tutorial when I said we'd define a block with a form? Well, now's the time to get right on it.

/src/Form/LoremIpsumBlockForm.php

Settings

Everything's pretty neat so far, but how do we change what we're seeing? With some forms, of course.

/src/Form/LoremIpsumForm.php

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8