Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Drupal 8 Theming with Twig

You're reading from   Drupal 8 Theming with Twig Master Drupal 8's new Twig templating engine to create fun and fast websites with simple steps to help you move from concept to completion

Arrow left icon
Product type Paperback
Published in Mar 2016
Publisher Packt
ISBN-13 9781782168737
Length 376 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Chaz Chumley Chaz Chumley
Author Profile Icon Chaz Chumley
Chaz Chumley
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Setting Up Our Development Environment 2. Theme Administration FREE CHAPTER 3. Dissecting a Theme 4. Getting Started – Creating Themes 5. Prepping Our Project 6. Theming Our Homepage 7. Theming Our Interior Page 8. Theming Our Blog Listing Page 9. Theming Our Blog Detail Page 10. Theming Our Contact Page 11. Theming Our Search Results 12. Tips, Tricks, and Where to Go from Here Index

Reviewing the new admin interface

Our local instance of Drupal 8 is similar to Drupal 7 when first viewing the site. You will note the default Bartik theme with the friendly Drupal drop logo and a tabbed main menu. It is here though where the similarities stop. Drupal 8 has been reworked from the ground up, including a brand new responsive layout and admin menu.

Exploring the admin menu

One of the nice new features of Drupal 8 is the rebuilt admin menu. Everything has been moved under the Manage menu item. The admin menu itself is responsive and will change from text and icon to icon only, as soon as the browser is resized to tablet screen size.

Exploring the admin menu

The admin menu can also be pinned to the left side of the window by clicking on the arrow icon to the right of the Help menu item.

Exploring the admin menu

The flexibility of the new admin menu enables the admin user to manage Drupal 8 websites from the browser or a tablet or a smartphone very easily.

Previewing the interface

Taking a closer look at the menu items contained in our admin menu, we begin to see some differences in how things are named and may wonder where to find once familiar settings and configurations. Let's quickly walk through these menu items now so that it is easier to find things as we progress later on in future chapters:

  • Content: This section displays any user-generated content, comments, and files with the ability to filter by Published status, Type, Title, and Language. The display for content is also now a view and can be customized with additional fields and filters as needed.
    Previewing the interface
  • Structure: This section is to manage Block layout, Comment types, Contact forms, Content types, Display modes, Menus, Taxonomy, and Views. We will explore some of the changes and new functionality contained within this section later on in the book.
    Previewing the interface
  • Appearance: This section is to enable, disable, and configure default themes as well as administrative themes.
    Previewing the interface
  • Extend: Formerly known as Modules, this section is for listing, updating, and uninstalling core, custom, and contributed modules. New is the ability to search for modules using a filter. Various contributed modules have been moved into core, including Views and CKEditor.
    Previewing the interface
  • Configuration: This section is designed to configure both core and contributed modules. Each area is grouped into functional sections and allows us to manage site information to file system to performance tuning.
    Previewing the interface
  • People: This section allows us to manage users, permissions, and roles. The display for users is now a View as well and can be customized to add additional fields and filters as needed.
    Previewing the interface
  • Reports: This section is designed to view available updates, recent log messages, field lists, status reports, top "access denied" errors, top "page not found" errors, top search phrases, and View plugins.
    Previewing the interface
  • Help: This section is designed to obtain helpful information on functionality necessary to know in administering a Drupal 8 website. This includes a Getting Started section and help topics on items, such as Block, Views, User, and more.
    Previewing the interface

Exploring Drupal 8 folder structure

There are several changes to Drupal 8 with regard to how files and folders are structured. Let's walk through the core, modules, sites, and themes folders and discuss some best practices for how each of these folders should be managed when creating a Drupal 8 website.

The core folder

One of the first things to point out is that the files and folder structure of Drupal 8 have changed from its predecessor Drupal 7. The first change is that everything that Drupal 8 needs to run is contained within the new core folder. No longer is there any confusion of having the modules and themes folders contained within a sites folder and having to ask "did I place my files in the correct location?".

The core folder

The core folder consists of miscellaneous files needed by Drupal to bootstrap the content management system as well as the following folders:

  • assets: Various external libraries used by core (jquery, modernizr, backbone, and others)
  • config: It contains misc configuration for installation and database schema
  • includes: It contains files and folders related to the functionality of Drupal
  • lib: Drupal core classes
  • misc: Various JavaScript files and images used by core
  • modules: Drupal core modules and Twig templates
  • profiles: Installation profiles
  • scripts: Various CLI scripts
  • tests: Drupal core tests
  • themes: Drupal core themes

The modules folder

While a lot of functionality, which was generally contained in a contributed module, has been moved into the core instance of Drupal 8, you will still find yourself needing to extend Drupal. Previously, you would locate a contributed module, download it, and then extract its contents into your sites/all/modules folder so that Drupal could then use it.

Contributed and custom modules are now placed into the modules folder, which is no longer contained inside your sites folder.

The modules folder

Best practices are to create a few subdirectories inside the modules folder for contributed modules—the modules built by third parties that we will use to extend your project, such as contrib, and custom, for the modules that we create on a per project basis. We will also occasionally find ourselves with a features folder if we plan to use the Features module to break out functionality that needs to be managed in code for purposes of migrating it easily to development, staging, and production instances of our website.

The sites folder

We are all familiar with the sites folder in Drupal 7. However, in Drupal 8, the sites folder only contains our Drupal instance configuration and files.

The sites folder

The themes folder

Finally, we have the themes folder. So, why don't we see the default themes that Drupal generally ships with inside this folder? That is because Drupal's default themes now are contained within the core folder. Finally, we will actually use the themes folder to place our custom or contributed themes inside it for use by Drupal.

We will be exploring the themes folder in more detail in later chapters as we begin creating custom themes.

The themes folder
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime