SlideShare a Scribd company logo
evolvingweb.ca @evolvingweb
Dipping Your Toe into Drupal
8 Module Development
WITH SUZANNE DERGACHEVA
• Co-founded Evolving Web in
2007
• Experienced Drupal themer,
developer, project lead
• Loves teaching DrupalSuzanne Dergacheva
CO-FOUNDER AND FRONT-END LEAD
Creating great websites
with Drupal
TRAINING WEB DEVELOPMENT WEB CONSULTING
Some of our happy clients
Should I Create a Module?
PROS
• You get a flexible solution
• Might be simpler than installing
a complex module
CONS
• Takes time/skills to develop
• You have to maintain the code
• Can introduce bugs
Simple Module Examples
• Change a form
• Add a programmatic block
• Add a programmatic page
• Add a menu link
• Create a field formatter
• Add custom validation
Before You Start
• Use the local.settings.php file and development.services.yml files
(https://www.drupal.org/node/2598914)
• Enables errors and warnings
• Disables some caching
• Disables aggregation of CSS/JS
• Install the Devel module
• Make sure your editor has syntax highlighting set up
Step 1: Research
• Is there already a module that does this?
• If not, is there something similar. Look for an example:
• Drupal core
• Contrib modules
• Examples module
• Try and find the code that does the thing you want
• Figure out how it integrates with Drupal (usually a hook or a Class)
Step 2: Create the Scaffolding
• Use the Drupal Console to write the scaffolding code or use
examples from other modules to see what structure you need
• Create a module folder, and an .info.yml file
• Then, add a Class or hook to your module
drupal generate:module
drupal generate:controller
Step 3: Fill in the Custom Code
• Write the logical part of your code that does the custom work
• Look for exmaples of what you’re trying to do
• You can copy and paste code snippets
• … But make sure you read/understand each line of code!
Step 4: Testing
• Easy to forget to test when you’re doing something simple
• QA Tips:
• Read error messages
• Make sure you understand what you’re testing (what is supposed
to change on the site)
• Also test that your code doesn’t break other use cases. You might
need to add an ‘if’ statement
Essential Terminology
• Yml - File format used to define modules/theme, permissions, paths,
menu items, and exported configuration
• Class - Group of properties and methods that define an object. Used
to extend parts of Drupal so you can create your own Forms, Blocks,
Fields, Entities, Webform Elements, etc.
• Plugin - Class that is ‘discoverable’ by Drupal. Examples: Blocks,
Fields
• Hook - Function that allows you to alter how something works in
Drupal. Examples: altering forms, emails, adding things to cron
Let’s Build a Module
Real Example Module
Link to the Edit Account Page
Link to the Edit Account Page
• Define a new path
• The path points to a Controller
• The controller redirects you to the path /user/[uid] but fills in the uid
of the current User
drupal generate:controller
drupal generate:module
Changing a Form
Changing a Form
• Find the form ID
• Implement hook_form_alter
• Add/remove/update elements of the form
• Use this reference: https://api.drupal.org/api/drupal/elements/8.2.x
drupal generate:form:alter
drupal generate:module
Useful Code Snippets
http://bit.ly/d8-snippets
Next Steps
• Drupal Docs for Creating Custom Modules: https://www.drupal.org/
docs/8/creating-custom-modules
• Try this tutorial: https://www.drupal.org/docs/8/creating-custom-
modules/a-hello-world-custom-page-module
• Download the Examples module: http://drupal.org/project/examples
Upcoming Drupal
Trainings
MAY 7-11, IN-PERSON

Drupal 8 Training in Princeton NJ
FEB 5-8, ONLINE

Drupal 8 Module Development
FEB 20-23, ONLINE

Migrate to Drupal 8
MARCH 1-2, ONLINE

Drupal 8 Site Building
MARCH 12-15, ONLINE

Drupal 8 Theming
evolvingweb.ca/training
training@evolvingweb.ca
@suzanne_kennedy
evolvingweb.ca @evolvingweb
Thank you!
Ad

More Related Content

What's hot (20)

Complex Content Structures and Workflow with Drupal
Complex Content Structures and Workflow with DrupalComplex Content Structures and Workflow with Drupal
Complex Content Structures and Workflow with Drupal
Balance Interactive
 
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
Andrew Barickman
 
Module 5 - WCM system comparison
Module 5 - WCM system comparison Module 5 - WCM system comparison
Module 5 - WCM system comparison
Katherine McCurdy-Lapierre, R.G.D.
 
Presentations4 Session9
Presentations4 Session9Presentations4 Session9
Presentations4 Session9
lalapoon
 
Sigma Xi Student Research Showcase Presentation
Sigma Xi Student Research Showcase PresentationSigma Xi Student Research Showcase Presentation
Sigma Xi Student Research Showcase Presentation
Sigma Xi, The Scientific Research Society
 
Slide share
Slide shareSlide share
Slide share
wwwindisch
 
Using wordpress as lms in comp. courses
Using wordpress as lms in comp. coursesUsing wordpress as lms in comp. courses
Using wordpress as lms in comp. courses
Matthew Vetter
 
WordPress and Accessibility
WordPress and AccessibilityWordPress and Accessibility
WordPress and Accessibility
Joseph Dolson
 
What to include in a boilerplate theme
What to include in a boilerplate themeWhat to include in a boilerplate theme
What to include in a boilerplate theme
Tim Brown
 
Blackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentationsBlackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentations
Gaik Bee Lim
 
Drupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesDrupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakes
Iztok Smolic
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short Tutorial
Christos Zigkolis
 
Rapid application development for WordPress using AWF
Rapid application development for WordPress using AWFRapid application development for WordPress using AWF
Rapid application development for WordPress using AWF
Tim Plummer
 
UCSY CS Club Week1
UCSY CS Club Week1UCSY CS Club Week1
UCSY CS Club Week1
Ye Linn Wai
 
How to Use the Slide Share Module on Squidoo.Com
How to Use the Slide Share Module on Squidoo.ComHow to Use the Slide Share Module on Squidoo.Com
How to Use the Slide Share Module on Squidoo.Com
LindaJM
 
How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.
Jay Bharat
 
CP3108B midterm presentation
CP3108B midterm presentationCP3108B midterm presentation
CP3108B midterm presentation
Mifeng
 
WordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopWordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshop
Jonny Allbut
 
Dj hagler
Dj haglerDj hagler
Dj hagler
Diane Gibson
 
Classroom Blog Math Conf 08
Classroom Blog Math Conf 08Classroom Blog Math Conf 08
Classroom Blog Math Conf 08
Darren Mosley
 
Complex Content Structures and Workflow with Drupal
Complex Content Structures and Workflow with DrupalComplex Content Structures and Workflow with Drupal
Complex Content Structures and Workflow with Drupal
Balance Interactive
 
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
Andrew Barickman
 
Presentations4 Session9
Presentations4 Session9Presentations4 Session9
Presentations4 Session9
lalapoon
 
Using wordpress as lms in comp. courses
Using wordpress as lms in comp. coursesUsing wordpress as lms in comp. courses
Using wordpress as lms in comp. courses
Matthew Vetter
 
WordPress and Accessibility
WordPress and AccessibilityWordPress and Accessibility
WordPress and Accessibility
Joseph Dolson
 
What to include in a boilerplate theme
What to include in a boilerplate themeWhat to include in a boilerplate theme
What to include in a boilerplate theme
Tim Brown
 
Blackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentationsBlackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentations
Gaik Bee Lim
 
Drupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesDrupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakes
Iztok Smolic
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short Tutorial
Christos Zigkolis
 
Rapid application development for WordPress using AWF
Rapid application development for WordPress using AWFRapid application development for WordPress using AWF
Rapid application development for WordPress using AWF
Tim Plummer
 
UCSY CS Club Week1
UCSY CS Club Week1UCSY CS Club Week1
UCSY CS Club Week1
Ye Linn Wai
 
How to Use the Slide Share Module on Squidoo.Com
How to Use the Slide Share Module on Squidoo.ComHow to Use the Slide Share Module on Squidoo.Com
How to Use the Slide Share Module on Squidoo.Com
LindaJM
 
How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.
Jay Bharat
 
CP3108B midterm presentation
CP3108B midterm presentationCP3108B midterm presentation
CP3108B midterm presentation
Mifeng
 
WordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopWordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshop
Jonny Allbut
 
Classroom Blog Math Conf 08
Classroom Blog Math Conf 08Classroom Blog Math Conf 08
Classroom Blog Math Conf 08
Darren Mosley
 

Similar to Dipping Your Toe into Drupal 8 Module Development (20)

Absolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalAbsolute Beginners Guide to Drupal
Absolute Beginners Guide to Drupal
Rod Martin
 
Using Features
Using FeaturesUsing Features
Using Features
Alexandru Badiu
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
72d5drupal
72d5drupal72d5drupal
72d5drupal
Mahesh Sherkar
 
Creating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - WebinarCreating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - Webinar
Suzanne Dergacheva
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices Catalogue
Alexandre Israël
 
Drupal 6x Installation
Drupal 6x Installation Drupal 6x Installation
Drupal 6x Installation
Micky Metts
 
Drupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 versionDrupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
Wong Hoi Sing Edison
 
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - at USG Tech DayCreating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
Suzanne Dergacheva
 
Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 module
tedbow
 
Get Up and Running Quickly with Drupal Distributions
Get Up and Running Quickly with Drupal DistributionsGet Up and Running Quickly with Drupal Distributions
Get Up and Running Quickly with Drupal Distributions
Melissa Piper
 
Create Your Own Starter Files
Create Your Own Starter FilesCreate Your Own Starter Files
Create Your Own Starter Files
Emily Lewis
 
Discover Drupal preview
Discover Drupal previewDiscover Drupal preview
Discover Drupal preview
dropsolid
 
Sample You Tube tutorial for Drupal
Sample You Tube tutorial for DrupalSample You Tube tutorial for Drupal
Sample You Tube tutorial for Drupal
sivaprasad balamara
 
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Intro
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal IntroDrupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Intro
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Intro
DrupalMumbai
 
Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018
LimoenGroen
 
Drupal Skils Lab 302Labs
Drupal Skils Lab 302Labs Drupal Skils Lab 302Labs
Drupal Skils Lab 302Labs
Ahmad Mohamad Zain
 
What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8
Suzanne Dergacheva
 
Drupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site Factory
Drupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site FactoryDrupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site Factory
Drupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site Factory
Acquia
 
Absolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalAbsolute Beginners Guide to Drupal
Absolute Beginners Guide to Drupal
Rod Martin
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
Creating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - WebinarCreating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - Webinar
Suzanne Dergacheva
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices Catalogue
Alexandre Israël
 
Drupal 6x Installation
Drupal 6x Installation Drupal 6x Installation
Drupal 6x Installation
Micky Metts
 
Drupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 versionDrupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
Wong Hoi Sing Edison
 
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - at USG Tech DayCreating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
Suzanne Dergacheva
 
Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 module
tedbow
 
Get Up and Running Quickly with Drupal Distributions
Get Up and Running Quickly with Drupal DistributionsGet Up and Running Quickly with Drupal Distributions
Get Up and Running Quickly with Drupal Distributions
Melissa Piper
 
Create Your Own Starter Files
Create Your Own Starter FilesCreate Your Own Starter Files
Create Your Own Starter Files
Emily Lewis
 
Discover Drupal preview
Discover Drupal previewDiscover Drupal preview
Discover Drupal preview
dropsolid
 
Sample You Tube tutorial for Drupal
Sample You Tube tutorial for DrupalSample You Tube tutorial for Drupal
Sample You Tube tutorial for Drupal
sivaprasad balamara
 
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Intro
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal IntroDrupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Intro
Drupal Global Training Day by Drupal Mumbai 6th Sep - Drupal Intro
DrupalMumbai
 
Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018
LimoenGroen
 
What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8What is Drupal? An Introduction to Drupal 8
What is Drupal? An Introduction to Drupal 8
Suzanne Dergacheva
 
Drupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site Factory
Drupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site FactoryDrupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site Factory
Drupal Step-by-Step: Building a Drupal Site with Acquia Cloud Site Factory
Acquia
 
Ad

More from Suzanne Dergacheva (20)

It's All About the Experience: What I’ve learnt from talking to thousands of ...
It's All About the Experience: What I’ve learnt from talking to thousands of ...It's All About the Experience: What I’ve learnt from talking to thousands of ...
It's All About the Experience: What I’ve learnt from talking to thousands of ...
Suzanne Dergacheva
 
Building a Great User Experience for Content Editors in Drupal 8
Building a Great User Experience for Content Editors in Drupal 8Building a Great User Experience for Content Editors in Drupal 8
Building a Great User Experience for Content Editors in Drupal 8
Suzanne Dergacheva
 
Device-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for DrupalDevice-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for Drupal
Suzanne Dergacheva
 
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon BaltimoreCreating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Suzanne Dergacheva
 
What is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? WebinarWhat is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? Webinar
Suzanne Dergacheva
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Suzanne Dergacheva
 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
Suzanne Dergacheva
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Suzanne Dergacheva
 
Upgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and GotchasUpgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and Gotchas
Suzanne Dergacheva
 
Migrate for Site Builders from MidCamp 2016
Migrate for Site Builders from MidCamp 2016Migrate for Site Builders from MidCamp 2016
Migrate for Site Builders from MidCamp 2016
Suzanne Dergacheva
 
The Wonderful World of Drupal 8 Multilingual
The Wonderful World of Drupal 8 MultilingualThe Wonderful World of Drupal 8 Multilingual
The Wonderful World of Drupal 8 Multilingual
Suzanne Dergacheva
 
Creating a Drupal Install Profile for a Large Organization
Creating a Drupal Install Profile for a Large OrganizationCreating a Drupal Install Profile for a Large Organization
Creating a Drupal Install Profile for a Large Organization
Suzanne Dergacheva
 
Intro to Drupal Migrate for Site Builders
Intro to Drupal Migrate for Site BuildersIntro to Drupal Migrate for Site Builders
Intro to Drupal Migrate for Site Builders
Suzanne Dergacheva
 
Drupal migrate-june2015
Drupal migrate-june2015Drupal migrate-june2015
Drupal migrate-june2015
Suzanne Dergacheva
 
10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Suzanne Dergacheva
 
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - WebinarCreating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
Suzanne Dergacheva
 
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Suzanne Dergacheva
 
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Suzanne Dergacheva
 
DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014
Suzanne Dergacheva
 
Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014
Suzanne Dergacheva
 
It's All About the Experience: What I’ve learnt from talking to thousands of ...
It's All About the Experience: What I’ve learnt from talking to thousands of ...It's All About the Experience: What I’ve learnt from talking to thousands of ...
It's All About the Experience: What I’ve learnt from talking to thousands of ...
Suzanne Dergacheva
 
Building a Great User Experience for Content Editors in Drupal 8
Building a Great User Experience for Content Editors in Drupal 8Building a Great User Experience for Content Editors in Drupal 8
Building a Great User Experience for Content Editors in Drupal 8
Suzanne Dergacheva
 
Device-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for DrupalDevice-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for Drupal
Suzanne Dergacheva
 
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon BaltimoreCreating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Suzanne Dergacheva
 
What is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? WebinarWhat is Drupal? And Why is it Useful? Webinar
What is Drupal? And Why is it Useful? Webinar
Suzanne Dergacheva
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Suzanne Dergacheva
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Suzanne Dergacheva
 
Upgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and GotchasUpgrading to Drupal 8: Benefits and Gotchas
Upgrading to Drupal 8: Benefits and Gotchas
Suzanne Dergacheva
 
Migrate for Site Builders from MidCamp 2016
Migrate for Site Builders from MidCamp 2016Migrate for Site Builders from MidCamp 2016
Migrate for Site Builders from MidCamp 2016
Suzanne Dergacheva
 
The Wonderful World of Drupal 8 Multilingual
The Wonderful World of Drupal 8 MultilingualThe Wonderful World of Drupal 8 Multilingual
The Wonderful World of Drupal 8 Multilingual
Suzanne Dergacheva
 
Creating a Drupal Install Profile for a Large Organization
Creating a Drupal Install Profile for a Large OrganizationCreating a Drupal Install Profile for a Large Organization
Creating a Drupal Install Profile for a Large Organization
Suzanne Dergacheva
 
Intro to Drupal Migrate for Site Builders
Intro to Drupal Migrate for Site BuildersIntro to Drupal Migrate for Site Builders
Intro to Drupal Migrate for Site Builders
Suzanne Dergacheva
 
10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box10 New Things You Can Do with Drupal 8 Out-of-the-Box
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Suzanne Dergacheva
 
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - WebinarCreating Dynamic Landing Pages for Drupal with Panels - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
Suzanne Dergacheva
 
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Suzanne Dergacheva
 
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Suzanne Dergacheva
 
DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014
Suzanne Dergacheva
 
Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014
Suzanne Dergacheva
 
Ad

Recently uploaded (20)

Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 

Dipping Your Toe into Drupal 8 Module Development

  • 1. evolvingweb.ca @evolvingweb Dipping Your Toe into Drupal 8 Module Development WITH SUZANNE DERGACHEVA
  • 2. • Co-founded Evolving Web in 2007 • Experienced Drupal themer, developer, project lead • Loves teaching DrupalSuzanne Dergacheva CO-FOUNDER AND FRONT-END LEAD
  • 3. Creating great websites with Drupal TRAINING WEB DEVELOPMENT WEB CONSULTING
  • 4. Some of our happy clients
  • 5. Should I Create a Module? PROS • You get a flexible solution • Might be simpler than installing a complex module CONS • Takes time/skills to develop • You have to maintain the code • Can introduce bugs
  • 6. Simple Module Examples • Change a form • Add a programmatic block • Add a programmatic page • Add a menu link • Create a field formatter • Add custom validation
  • 7. Before You Start • Use the local.settings.php file and development.services.yml files (https://www.drupal.org/node/2598914) • Enables errors and warnings • Disables some caching • Disables aggregation of CSS/JS • Install the Devel module • Make sure your editor has syntax highlighting set up
  • 8. Step 1: Research • Is there already a module that does this? • If not, is there something similar. Look for an example: • Drupal core • Contrib modules • Examples module • Try and find the code that does the thing you want • Figure out how it integrates with Drupal (usually a hook or a Class)
  • 9. Step 2: Create the Scaffolding • Use the Drupal Console to write the scaffolding code or use examples from other modules to see what structure you need • Create a module folder, and an .info.yml file • Then, add a Class or hook to your module drupal generate:module drupal generate:controller
  • 10. Step 3: Fill in the Custom Code • Write the logical part of your code that does the custom work • Look for exmaples of what you’re trying to do • You can copy and paste code snippets • … But make sure you read/understand each line of code!
  • 11. Step 4: Testing • Easy to forget to test when you’re doing something simple • QA Tips: • Read error messages • Make sure you understand what you’re testing (what is supposed to change on the site) • Also test that your code doesn’t break other use cases. You might need to add an ‘if’ statement
  • 12. Essential Terminology • Yml - File format used to define modules/theme, permissions, paths, menu items, and exported configuration • Class - Group of properties and methods that define an object. Used to extend parts of Drupal so you can create your own Forms, Blocks, Fields, Entities, Webform Elements, etc. • Plugin - Class that is ‘discoverable’ by Drupal. Examples: Blocks, Fields • Hook - Function that allows you to alter how something works in Drupal. Examples: altering forms, emails, adding things to cron
  • 13. Let’s Build a Module
  • 15. Link to the Edit Account Page
  • 16. Link to the Edit Account Page • Define a new path • The path points to a Controller • The controller redirects you to the path /user/[uid] but fills in the uid of the current User drupal generate:controller drupal generate:module
  • 18. Changing a Form • Find the form ID • Implement hook_form_alter • Add/remove/update elements of the form • Use this reference: https://api.drupal.org/api/drupal/elements/8.2.x drupal generate:form:alter drupal generate:module
  • 20. Next Steps • Drupal Docs for Creating Custom Modules: https://www.drupal.org/ docs/8/creating-custom-modules • Try this tutorial: https://www.drupal.org/docs/8/creating-custom- modules/a-hello-world-custom-page-module • Download the Examples module: http://drupal.org/project/examples
  • 21. Upcoming Drupal Trainings MAY 7-11, IN-PERSON
 Drupal 8 Training in Princeton NJ FEB 5-8, ONLINE
 Drupal 8 Module Development FEB 20-23, ONLINE
 Migrate to Drupal 8 MARCH 1-2, ONLINE
 Drupal 8 Site Building MARCH 12-15, ONLINE
 Drupal 8 Theming evolvingweb.ca/training [email protected]