万本电子书0元读

万本电子书0元读

顶部广告

Drupal 8 Module Development电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:Daniel Sipos

出  版  社:Packt Publishing

出版时间:2019-03-28

字       数:84.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Learn to create and customize impressive Drupal 8 modules to extend your website's functionalities Key Features * Explore a plethora of Drupal 8 APIs and get the best out of them using the power of PHP coding * Learn to implement efficient data management and data security by creating dedicated modules for it. * Stay up to date with the changes introduced in the new Drupal 8 releases Book Description Drupal 8 comes with a release cycle that allows for new functionality to be added at a much faster pace. However, this also means code deprecations and changing architecture that you need to stay on top of. This book updates the first edition and includes the new functionality introduced in versions up to, and including 8.7. The book will first introduce you to the Drupal 8 architecture and its subsystems before diving into creating your first module with basic functionality. You will work with the Drupal logging and mailing systems, learn how to output data using the theme layer and work with menus and links programmatically. Then, you will learn how to work with different kinds of data storages, create custom entities, field types and leverage the Database API for lower level database queries. You will further see how to introduce JavaScript into your module, work with the various file systems and ensure the code you write works on multilingual sites. Finally, you will learn how to programmatically work with Views, write automated tests for your functionality and also write secure code in general. By the end, you will have learned how to develop your own custom module that can provide complex business solutions. And who knows, maybe you’ll even contribute it back to the Drupal community. What you will learn * Develop Drupal 8 modules that do all the things you want * Master numerous Drupal 8 sub-systems and APIs in the process * Model, store, manipulate and process data to serve your purposes * Display data and content in a clean and secure way using the Drupal 8 theme system * Test your business logic to prevent regressions * Stay ahead of the curve and write code following the current best practices Who this book is for The primary target of this book is Drupal developers who want to learn how to write modules and develop in Drupal 8. It is also intended for Drupal site builders and PHP developers who have basic Object Oriented Programming skills. A little bit of Symfony experience is helpful but not mandatory.
目录展开

Title Page

Copyright and Credits

Drupal 8 Module Development Second Edition

About Packt

Why subscribe?

Packt.com

Foreword

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Developing for Drupal 8

Introducing Drupal (for developers)

Developing for Drupal 8

Technologies that drive Drupal

PHP

Databases and MySQL

The web server

HTML, CSS, and JavaScript

Drupal architecture

Drupal core, modules, and themes

Hooks, plugins, and events

Services and the dependency injection container

From request to response

Drupal's major subsystems

Routing

Entities

Fields

Menus

Views

Forms

Configuration

Plugins

The theme system

Caching

Other subsystems

Tools for developing in Drupal

Version control

Composer

The API site and coding standards

The developer (Devel) module

Drush (the Drupal shell)

Drupal Console

Developer settings

Summary

Creating Your First Module

Creating a module

Your first hook implementation

Route and controller

The route

Route variables

Namespaces

The Controller

Services

What is a service?

The HelloWorldSalutation service

Tagged services

Using services in Drupal 8

Injecting the service into our Controller

Invoked Controllers

The form

Altering forms

Custom submit handlers

Rendering forms

Service dependencies

Blocks

Our first block plugin

Block configuration

Working with links

The URL

The link

Which way to link?

Event Dispatcher and redirects

Redirecting from a Controller

Redirecting from a subscriber

Dispatching events

Summary

Logging and Mailing

Logging

The Drupal 8 logging theory

Our own logger channel

Our own logger

Logging for Hello World

Logging summary

Mail API

The theory of the Mail API

Implementing hook_mail()

Sending emails

Altering someone else's emails

Custom mail plugins

The mail plugin

Using mail plugins

Tokens

The Token API

Using tokens

Defining new tokens

Token summary

Summary

Theming

Business logic versus presentation logic

Twig

Theme hooks

Theme hook suggestions

Render arrays

The structure of a render array

#type

#theme

#markup

The render pipeline

Assets and libraries

Libraries

Attaching libraries

Common theme hooks

Lists

Links

Tables

Attributes

Layouts

Defining layouts

Rendering a layout

Theming our Hello World module

Summary

Menus and Menu Links

The menu system

Menus

Menu links

Multiple types of menu links

Local tasks

Local actions

Contextual links

MenuLink trees

Menu link tree manipulators

Menu active trail

Rendering menus

Working with menu links

Defining menu links

Working with menu links

Defining local tasks

Defining local actions

Defining contextual links

Summary

Data Modeling and Storage

Different types of data storage

State API

TempStore

Private TempStore

Shared TempStore

Tempstore conclusion

UserData

Configuration

Introduction

What is configuration used for?

Managing configuration

Different types of configuration

Configuration storage

Schema

Overrides

Global overrides

Module overrides

Language overrides

Priority

Interacting with simple configuration

Entities

Content versus configuration entity types

Entity type plugins

Identifiers

Bundles

Database tables

Entity keys

Links

Entity translation

Entity revisions

Configuration export

Handlers

Fields

Configuration entity fields

Content entity fields

Base fields

Configurable fields

Field storage

Entity types summary

TypedData

Why TypedData?

What is TypedData?

The low-level API

DataType plugins

Data definitions

Content entities

TypedData summary

Interacting with the Entity API

Querying entities

Building queries

Loading entities

Reading entities

Manipulating entities

Creating entities

Rendering content entities

Pseudo-fields

Entity validation

Content entities

Configuration entities

Validation summary

Summary

Your Own Custom Entity and Plugin Types

Custom content entity type

Custom plugin type

Custom configuration entity type

The Importer plugin

Content entity bundles

Drush command

Summary

The Database API

The Schema API

Running queries

Select queries

Handling the result

More complex select queries

Range queries

Pagers

Insert queries

Update queries

Delete queries

Transactions

Query alters

Update hooks

Summary

Custom Fields

A recap of Field type plugins

Field type

Field widget

Field formatter

Field settings

Using our custom field type as a base field

Summary

Access Control

Introduction to the Drupal access system

Roles and permissions under the hood

Defining permissions

Checking the user credentials

Route access

Custom route access

Static approach

Service approach

Programmatically checking access on routes

Bonus—dynamic route options for access control

CSRF protection on routes

Altering routes

Entity access

Injecting services into Entity handlers

Entity access hooks

Field access

Entity access in routes

Node access grants

Block access

Summary

Caching

Introduction to Caching

Cacheability metadata

Cache tags

Cache contexts

Max-age

Using the cache metadata

Caching in block plugins

Caching access results

Placeholders and lazy building

Lazy builders

Using the Cache API

Creating our own cache bin

Summary

JavaScript and the Ajax API

JavaScript in Drupal

Drupal behaviors

Our library

The JavaScript

Drupal settings

The Ajax API

Ajax links

Ajax in forms

States (Form) system

Summary

Internationalization and Languages

Introduction to the multilingual ecosystem

Language

Content translation

Configuration translation

Interface translation

Internationalization

Content entities and the Translation API

Summary

Batches, Queues, and Cron

Batch-powered update hooks

Batch operations

Creating the batch

Batch operations

Cron

Queues

Introduction to the Queue API

Cron-based queues

Processing a queue programmatically

The Lock API

Summary

Views

Entities in Views

Exposing custom data to Views

Views data

Views fields

Views relationships

Views sorts and filters

Views arguments

Altering Views data

Custom Views field

Field configuration

Custom Views filter

Custom Views argument

Views theming

Views hooks

Summary

Working with Files and Images

The filesystem

Stream wrappers

Managed versus unmanaged files

Using the File and Image fields

Working with managed files

Attaching managed files to entities

Helpful functions for dealing with managed files

Managed file uploads

Managed file form element

Entity CRUD hooks

Managed file usage service

Processing the CSV file

Our own stream wrapper

Working with unmanaged files

Private filesystem

Images

Image toolkits

Image styles

Rendering images

Summary

Automated Testing

Testing methodologies in Drupal 8

PHPUnit

Registering tests

Unit tests

Mocked dependencies

Kernel tests

TeamCleaner test

CsvImporter test

Functional tests

Configuration for functional tests

Hello World page test

Hello World form test

Functional JavaScript tests

Time test

CsvImporter test

Summary

Drupal 8 Security

Cross-Site Scripting (XSS)

Sanitization methods in Drupal 8

Double escaping

SQL Injection

Cross-Site Request Forgery (CSRF)

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部