SlideShare una empresa de Scribd logo
1 de 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!

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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 a 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 a 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
 

Más de 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
 

Más de 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
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

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