Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Drupal 8 Development Cookbook
Drupal 8 Development Cookbook

Drupal 8 Development Cookbook: Harness the power of Drupal 8 with this practical recipe-based guide , Second Edition

eBook
$9.99 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Drupal 8 Development Cookbook

The Content Authoring Experience

In this chapter, we will explore what Drupal 8 brings to the content authoring experience:

  • Configuring the WYSIWYG editor
  • Adding and editing content
  • Creating a menu and linking content
  • Providing inline editing
  • Creating a custom content type
  • Applying new Drupal 8 core field types
  • Customizing the form display of a node
  • Customizing the display output of a node

Introduction


In this chapter, we'll cover the Drupal 8 content authoring experience. We will show you how to configure text formats and set up the bundled CKEditor that ships with Drupal 8. We will take a look at how to add and manage content and utilize menus to link to content. Drupal 8 ships with inline editing for per-field modifications from the frontend.

This chapter dives into creating custom content types and harnessing different fields to create advanced content. We'll cover the five new fields added to Drupal 8 core and how to use them, along with configuring new field types through contributed projects. We will go through customizing the content's display and modifying the new form display added in Drupal 8.

Configuring the WYSIWYG editor


Drupal 8 saw the collaboration between the Drupal development community and the CKEditor development community. Because of this, Drupal now ships with CKEditor out of the box as the default What You See Is What You Get (WYSIWYG) editor. The new Editor module provides an API to integrate WYSIWYG editors. Although CKEditor is provided out of the box, contributed modules can provide integrations with other WYSIWYG editors.

Text formats control the formatting of content and WYSIWYG editor configuration for content authors. The standard Drupal installation profile provides a fully configured text format with the enabled CKEditor. We will walk through the steps of recreating this text format.

In this recipe, we will create a new text format with a custom CKEditor WYSIWYG configuration.

Getting ready

Before starting, make sure that the CKEditor module is enabled, which also requires Editor as a dependency. Editor is the module that provides an API to integrate WYSIWYG...

Adding and editing content


The main functionality of a content management system is in the name itself--the ability to manage content; that is, to add, edit, and organize content. Drupal provides a central form that allows you to manage all of the content within your website and allows you to create new content. Additionally, you can view a piece of content and click on an edit link when viewing it.

Getting ready

This recipe assumes that you have installed the standard installation profile and have the default node content types available for use.

How to do it...

Let's manage the content by adding, editing, and organizing the content:

  1. Go to Content to view the content management overview from.
  2. Click on Add content to view the list of available content types.
  3. Click on Article as the piece of content you would like to make.
  4. Provide a title for the piece of content. Titles are always required for content. Fill in the body text for the article:

Note

You may change the text format to customize what kind...

Creating a menu and linking content


Drupal provides a way to link content being authored to a specified menu on the website, generally the main menu. You can, however, create a custom menu to provide links to content. In this recipe, we will show you how to create a custom menu and link content to it. We will then place the menu as a block on the page, in the sidebar.

Getting ready

This recipe assumes that you have installed the standard installation profile and have the default node content types available for use. You should have some content created to create a link.

How to do it...

  1. Visit Structure and click on Menus.
  2. Click on Add menu.
  3. Provide the title Sidebar and optional summary and then click on Save.
  4. Once the menu is saved, click on the Add link button.
  5. Enter a link title and then type the title for a piece of content. The form will provide autocomplete suggestions for linkable content:
  1. Click on Save to save the menu link.
  2. With the menu link saved, go to Structure, and then Block layout....

Providing inline editing


A touted feature of Drupal 8 is the ability to provide inline editing. Inline editing is enabled by default with the standard installation profile through the Quick Edit module. The Quick Edit module allows editing individual fields while viewing a piece of content, and integrates it with the Editor module for WYSIWYG editors!

How to do it...

Let's provide inline editing:

  1. Go to a piece of created content.
  2. In order to enable inline editing, you must toggle contextual links on the page by clicking on Edit in the upper right of the administrative toolbar:
  1. This will toggle the contextual links available on the page. Click on the context link next to the content and select Quick edit:
  1. Hover over the body text and click on Edit. You can now edit the text with a minimal version of the WYSIWYG editor toolbar:
  1. Once you have changed the text, click on Save.
  2. The changes will be saved immediately.

How it works...

The Contextual links module provides privileged users with shortcut links...

Creating a custom content type


Drupal excels in the realm of content management by allowing different types of content. In this recipe, we will walk you through creating a custom content type. We will create a Services type that has some basic fields and would be used in a scenario that brings attention to a company's provided services.

You will also learn how to add fields to a content type in this recipe, which generally goes hand in hand with making a new content type on a Drupal site.

How to do it...

  1. Go to Structure and then Content types. Click on Add content type to begin creating a new content type.
  2. Enter Services as the name, and an optional description.
  3. Select Display settings and uncheck the Display author and date information checkbox. This will hide the author and submitted time from services pages:
  1. Click on the Save and manage fields button to save the new content type and manage its fields.
  2. By default, new content types have a Body field automatically added to them. We will keep this...

Applying new Drupal 8 core field types


The field system is what makes creating content in Drupal so robust. With Drupal 8, some of the most used contributed field types have been merged into Drupal core as their own module. In fact, Entity Reference is no longer a module but part of the main Field API now.

This recipe is actually a collection of mini-recipes to highlight the new fields provided by Drupal 8 core: Link, Email, Telephone, Date, and Entity reference.

Getting ready

The standard installation profile does not enable all of the modules that provide these field types by default. For this recipe, you will need to manually enable select modules so that you can create the field. The module that provides the field type and its installation status in the standard profile will be highlighted.

Each recipe will start off expecting that you have enabled the module, if needed, and that you are at the Manage fields form of a content type and have clicked on Add field and provided a field label...

Customizing the form display of a node


The latest in Drupal 8 is the availability of form display modes. Form modes allow a site administrator to configure different field configurations for each content entity bundle edit form. In the case of nodes, you have the ability to rearrange and alter the display of fields and properties on the node edit form.

In this recipe, we'll modify the default form for creating the Article content type that comes with the standard installation profile:

How to do it...

  1. To customize the form display mode, go to Structure and then Content Types.
  2. We will modify the Article content type's form. Click on the expand the OPERATIONS dropdown and select Manage form display.
  1. First, we will modify the Comments field. Click on the drag icon to the left and drag the row into the Disabled section. Follow the same steps for the sticky at top of lists field:
  1. Click on the settings cog for the Body field. Enter in a placeholder for the field, such as Enter your article text here...

Customizing the display output of a node


Drupal provides display view modes that allow for customization of the fields and other properties attached to an entity. In this recipe, we will adjust the teaser display mode of an Article. Each field or property has a control for displaying the label, the format to display the information in, and additional settings for the format.

Harnessing view displays allows you to have full control over how content is viewed on your Drupal site.

How to do it...

  1. Now, it is time to customize the form display mode by navigating to Structure and then Content Types.
  2. We will modify the Article content type's display. Click on the dropdown button arrow and select Manage display.
  3. Click on the Teaser view mode option to modify it. The teaser view mode is used in node listings, such as the default homepage:
  1. Change the format for Tags to be Hidden. Additionally, this can be accomplished by dragging it to the hidden section. The tags on an article will no longer be displayed...
Left arrow icon Right arrow icon

Key benefits

  • Discover the enhanced content authoring experience that comes with Drupal 8 and how to customize it
  • Take advantage of the broadened multilingual and tools of the new version to provide an internationalized website
  • This step-by-step guide will show you how to deploy from development, staging, and production of a website with Drupal 8's brand new configuration management system

Description

Began as a message board, Drupal today is open source software maintained and developed by a community of over 1,000,000 users and developers. Drupal is used by numerous local businesses to global corporations and diverse organizations all across the globe. With Drupal 8’s exciting features it brings, this book will be your go-to guide to experimenting with all of these features through helpful recipes. We’ll start by showing you how to customize and configure the Drupal environment as per your requirements, as well as how to install third-party libraries and then use them in the Drupal environment. Then we will move on to creating blocks and custom modules with the help of libraries. We will show you how to use the latest mobile-first feature of Drupal 8, which will help you make your apps responsive across all the major platforms. This book will also show you how to incorporate multilingual facilities in your sites, use web services and third-party plugins with your applications from inside Drupal 8, and test and deploy your apps.

Who is this book for?

The audience of the Drupal 8 Cookbook have been using Drupal and are ready to get a grasp of what to expect in Drupal 8. They have worked with Drupal as site builders, back-end developers, and front-end developers and are eager to see what awaits when they start using Drupal 8. This book will be a resource that allows them to get started and have a reference to building new applications with Drupal.

What you will learn

  • Extend Drupal through contributed or custom modules and themes
  • Develop an internationalized website with Drupal s multilingual tools
  • Integrate third-party front-end and back-end libraries with Drupal
  • Turn Drupal into a web services provider using REST
  • Create a mobile-first responsive Drupal application
  • Run SimpleTest and PHPUnit to test Drupal
  • Understand the plugin system that powers many of Drupal 8 s new APIs to extend its functionality
  • Get to grips with the mechanics of the configuration management system and the ability to import and export site configuration

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 26, 2017
Length: 430 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788299220
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 26, 2017
Length: 430 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788299220
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 141.97
Drupal 8 Blueprints
$43.99
Drupal 8 Development Cookbook
$48.99
Drupal 8 Module Development
$48.99
Total $ 141.97 Stars icon
Banner background image

Table of Contents

13 Chapters
Up and Running with Drupal 8 Chevron down icon Chevron up icon
The Content Authoring Experience Chevron down icon Chevron up icon
Displaying Content through Views Chevron down icon Chevron up icon
Extending Drupal Chevron down icon Chevron up icon
Frontend for the Win Chevron down icon Chevron up icon
Creating Forms with the Form API Chevron down icon Chevron up icon
Plug and Play with Plugins Chevron down icon Chevron up icon
Multilingual and Internationalization Chevron down icon Chevron up icon
Configuration Management - Deploying in Drupal 8 Chevron down icon Chevron up icon
The Entity API Chevron down icon Chevron up icon
Off the Drupalicon Island Chevron down icon Chevron up icon
Web Services Chevron down icon Chevron up icon
The Drupal CLI Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7
(3 Ratings)
5 star 66.7%
4 star 33.3%
3 star 0%
2 star 0%
1 star 0%
Alex Sluiter Nov 24, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Reads like a true cook book with quality executable examples. It’s something you can refer back to even after learning the inner workings of Drupal.
Amazon Verified review Amazon
Christian Apr 26, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Super useful and contains almost everything you need to know about drupal 8.I liked that it contained coding, site building but also deployment and testing.
Amazon Verified review Amazon
John Lewis Sep 08, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Great introductory book on basic Drupal 8 concepts and how to use them, but the subject matter is so deep the cookbook style doesn't give enough depth of understanding. Yes, I see I have to create three files in these directories but I don't understand why and if I want to alter to recipe to be something different, how do I do that?It's exactly what it says it is, I should have skimmed the TOCs to see if there was a specific mention of the topic I needed help with. Drupal 8 is radically different than Drupal 7 and a cookbook isn't going to give you the understanding of how to move from one style to another.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.