12
Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module

Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

  • Upload
    ngokhue

  • View
    227

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal 8 Module Development and Debugging

Lessons Learned from Upgrading the Node Hierarchy Module

Page 2: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

About Dan Harris

● Founder Webdrips.com ○ Drupal-based web design and development shop ○ Founded in July, 2011. ○ Nine years Drupal experience○ 21 years professional experience.

● Twitter @webdrips● Email [email protected]

Page 3: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Agenda● D8 Development Overview

○ PhpStorm● Rapid Development with Drupal Console● D8 Debugging Tips & Tricks● Examples Module(s), demo● Review of Node Hierarchy Upgrade● Q&A Session

Page 4: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal Console (DC)● Command line tool suite helps you learn D8

○ See the --learning option● Generates boilerplate D8 code / files● Uses same modern PHP practices as D8● Gets you up-and-running quickly● Provides high-level D8 debugging● Demo time

Page 5: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal Console Demo

● We’ll look at the following○ drupal list○ drupal generate:module○ drupal generate:form:config○ drupal generate:permissions

Page 6: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal Console Debugging

● We’ll run a few Drupal commands○ drupal config:debug○ drupal cron:debug○ drupal image:styles:debug

Page 7: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal Examples Modules

● Solid D8 examples with good documentation● Examples for blocks, cache, config, new

content types, and much more.● Demo

Page 8: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Debugging Notes● Devel module to the rescue

○ Quick and dirty○ D8 ver. Uses Kint, the modern version of krumo○ For content entities, more may be needed

<?php

dpm($node->toArray());

dpm($node->getFieldDefinitions()); OR

dsm(get_object_vars($entity));

dsm(get_class_methods($entity));

?>

Page 9: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal 8 Built-in Debugging

● Devel has a great backtrace function (demo)○ ddebug_backtrace();

● Drupal 8 includes a debugging mode for development sites○ Uses settings.local.php○ $config['system.logging']['error_level'] = 'verbose';

● Debugging plugins

Page 10: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Drupal 8 Development Walkthrough

Let’s look under the hood for Node Hierarchy

Page 11: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

Q & A Time

I’ll try to answer your questions now.

If you have any follow-up questions, email [email protected]

Page 12: Debugging Drupal 8 Module Development and · Drupal 8 Module Development and Debugging Lessons Learned from Upgrading the Node Hierarchy Module. About Dan Harris Founder Webdrips.com

About Webdrips

● Webdrips provides concept to production web design and development.

● We turn complex business logic problems into sophisticated, yet easy-to-use sites.

● We provide websites that empower your content editors to make additions and changes to your website.