SlideShare a Scribd company logo
1 of 22
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!

More Related Content

What's hot

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 DrupalBalance 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 Session9lalapoon
 
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. coursesMatthew Vetter
 
WordPress and Accessibility
WordPress and AccessibilityWordPress and Accessibility
WordPress and AccessibilityJoseph 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 themeTim Brown
 
Blackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentationsBlackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentationsGaik Bee Lim
 
Drupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesDrupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesIztok Smolic
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialChristos 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 AWFTim Plummer
 
UCSY CS Club Week1
UCSY CS Club Week1UCSY CS Club Week1
UCSY CS Club Week1Ye 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.ComLindaJM
 
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 presentationMifeng
 
WordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopWordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopJonny Allbut
 
Classroom Blog Math Conf 08
Classroom Blog Math Conf 08Classroom Blog Math Conf 08
Classroom Blog Math Conf 08Darren Mosley
 

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
 
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?
 
Module 5 - WCM system comparison
Module 5 - WCM system comparison Module 5 - WCM system comparison
Module 5 - WCM system comparison
 
Presentations4 Session9
Presentations4 Session9Presentations4 Session9
Presentations4 Session9
 
Sigma Xi Student Research Showcase Presentation
Sigma Xi Student Research Showcase PresentationSigma Xi Student Research Showcase Presentation
Sigma Xi Student Research Showcase Presentation
 
Slide share
Slide shareSlide share
Slide share
 
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
 
WordPress and Accessibility
WordPress and AccessibilityWordPress and Accessibility
WordPress and Accessibility
 
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
 
Blackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentationsBlackboard: Using slideshare for presentations
Blackboard: Using slideshare for presentations
 
Drupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakesDrupal 8: Most common beginner mistakes
Drupal 8: Most common beginner mistakes
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short Tutorial
 
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
 
UCSY CS Club Week1
UCSY CS Club Week1UCSY CS Club Week1
UCSY CS Club Week1
 
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
 
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.
 
CP3108B midterm presentation
CP3108B midterm presentationCP3108B midterm presentation
CP3108B midterm presentation
 
WordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshopWordCamp Birmingham 2015 - Theme building workshop
WordCamp Birmingham 2015 - Theme building workshop
 
Dj hagler
Dj haglerDj hagler
Dj hagler
 
Classroom Blog Math Conf 08
Classroom Blog Math Conf 08Classroom Blog Math Conf 08
Classroom Blog Math Conf 08
 

Similar to Dipping Your Toe into Drupal 8 Module Development

Absolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalAbsolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalRod 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 coreDan 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 - WebinarSuzanne Dergacheva
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueAlexandre 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 versionDavid 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 8Wong 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 DaySuzanne Dergacheva
 
Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 moduletedbow
 
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 DistributionsMelissa Piper
 
Create Your Own Starter Files
Create Your Own Starter FilesCreate Your Own Starter Files
Create Your Own Starter FilesEmily Lewis
 
Discover Drupal preview
Discover Drupal previewDiscover Drupal preview
Discover Drupal previewdropsolid
 
Sample You Tube tutorial for Drupal
Sample You Tube tutorial for DrupalSample You Tube tutorial for Drupal
Sample You Tube tutorial for Drupalsivaprasad 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 IntroDrupalMumbai
 
Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018LimoenGroen
 
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 8Suzanne 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 FactoryAcquia
 

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
 
Using Features
Using FeaturesUsing Features
Using Features
 
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
 
72d5drupal
72d5drupal72d5drupal
72d5drupal
 
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
 
The Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices CatalogueThe Drupal 7 Worst Practices Catalogue
The Drupal 7 Worst Practices Catalogue
 
Drupal 6x Installation
Drupal 6x Installation Drupal 6x Installation
Drupal 6x Installation
 
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
 
[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
 
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
 
Your first d8 module
Your first d8 moduleYour first d8 module
Your first d8 module
 
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
 
Create Your Own Starter Files
Create Your Own Starter FilesCreate Your Own Starter Files
Create Your Own Starter Files
 
Discover Drupal preview
Discover Drupal previewDiscover Drupal preview
Discover Drupal preview
 
Sample You Tube tutorial for Drupal
Sample You Tube tutorial for DrupalSample You Tube tutorial for Drupal
Sample You Tube tutorial for Drupal
 
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
 
Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018Open drupal DrupalCamp Gent 2018
Open drupal DrupalCamp Gent 2018
 
Drupal Skils Lab 302Labs
Drupal Skils Lab 302Labs Drupal Skils Lab 302Labs
Drupal Skils Lab 302Labs
 
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
 
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
 

More from 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 8Suzanne Dergacheva
 
Device-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for DrupalDevice-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for DrupalSuzanne 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 BaltimoreSuzanne 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? WebinarSuzanne 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 DublinSuzanne 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 ThemeSuzanne 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 GotchasSuzanne 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 2016Suzanne 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 MultilingualSuzanne 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 OrganizationSuzanne 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 BuildersSuzanne 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-BoxSuzanne 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 - WebinarSuzanne 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 2014Suzanne Dergacheva
 
DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014Suzanne Dergacheva
 
Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014Suzanne Dergacheva
 

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 ...
 
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
 
Device-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for DrupalDevice-Agnostic Content Strategy for Drupal
Device-Agnostic Content Strategy for Drupal
 
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
 
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
 
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
 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
 
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
 
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
 
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
 
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
 
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
 
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
 
Drupal migrate-june2015
Drupal migrate-june2015Drupal migrate-june2015
Drupal migrate-june2015
 
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
 
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
 
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...
 
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
 
DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014DrupalCamp NYC Panels Presentation - April 2014
DrupalCamp NYC Panels Presentation - April 2014
 
Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014Using Panels Wisely - DrupalCamp Ottawa 2014
Using Panels Wisely - DrupalCamp Ottawa 2014
 

Recently uploaded

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 

Recently uploaded (20)

Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 

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 training@evolvingweb.ca