SlideShare a Scribd company logo
D7 as D8
Pablo López Escobés
#D7asD8
Mateu Aguiló
Senior developer at Lullabot
e0ipso
Pablo López
Developer at Bluespark
plopesc
Team
I came to talk about
my module!
D7 as D8
Motivations
• Learn about Drupal 8
• Improve our skills
• Experimentation
• No need to waste free time or money
• Have fun
We are not discovering sliced bread
• There are already modules helping us:
• X Autoload, Composer manager, Service Container
• Other people is writing blog posts about this:
• https://www.previousnext.com.au/tags/drupal-8-now
• http://cambrico.net/drupal/using-composer-to-build-your-drupal-7-
projects
Why Plugins?
• Plugins are a key component in D8
• Field types, Entity types, Image effects...
• D8 plugin system is Drupal agnostic (lib/Drupal/Component folder)
• A lot of problems can be solved using plugins
It started with basic plugins, but then it spread!
We created Plug Family
Plug architecture
• Packagist package created from D8 source code: drupal/d7-plugin
• Download and register the package to be used via Composer manager
• Plug module provides some glue code to integrate the plugin system
• Register PSR-4 namespace for classes via X Autoload
• Base classes to make easier the plugin creation
Plugin discovery types
Annotation based plugins
Plugin classes are annotated and placed in a defined namespace.
Class Acme:
namespace Drupalplug_examplePlugincompany;
/**
* @Company(
* id = "acme",
* country = "USA"
* )
*/
class Acme extends CompanyBase implements CompanyInterface {
Plugin discovery types
YAML based discovery
Plugins are listed in YAML files. This is mainly useful if all plugins use the
same class.
Class Fruit:
apple:
label: Apple
sugar: 'low'
namespace Drupalplug_examplePluginfruit;
class Fruit extends PluginBase implements FruitInterface {
Plug Field
• Emulate the Drupal 8 Field System
• Expose Field types, widgets and formatters as annotated plugins
• Provide base classes to extend easily
Plug Config
• Create exportable entities as annotated plugins
• Wrapper around Drupal 7 entities
• Alternative to CTools plugins:
• Object Oriented Plugins
• Actually are entities
Typed Entity (does not need Plug)
• Organize your custom code around entities in objects
• Forget my_module_process_article_images($nid)
• Use $article->processImage() instead
• It's a very lightweight module. Can complement Plug
• More re-use of code: Code is centralized & You can use base classes
• Objects are easy to pass around
Typed Entity: Example code
1. Create the class with your custom methods
2. Use that object in your regular Drupal code
namespace Drupalmy_moduleTypedEntity;
class TypedNodeArticle extends TypedNode implements TypedNodeInterface {
function hook_drupalcamp_blow_mind($node) {
$article = TypedEntityManager::create('node', $node);
foreach ($article->getRelatedArticles() as $related) {
// $related->getImage() returns a TypedFileImage!
$image_urls[] = $related->getImage()->getUrl();
}
}
Use case example
Somos twisters billing system
• NGO fundraising company
• Manage multiple non profit companies
• Complex bonus system for callers
• Multiple roles
Hot topics
• Custom plugins for different billing
calculators
• Plug
• Multiple custom entity types
• Entity boilerplate
• Custom field types for bonuses and penalties
• Plug Field
Field diagram
• 7 Field type classes
• 1 main abstract class
• 4 Interfaces
• Extra features for invoicing tasks
I did it
in a.module file
...but show me
the code!
Why we do love this stuff
• Maintainability
• Have fun learning a new way to solve problems
• Investigate and discover new programming patterns
• Be ready for all the new Drupal 8 coding paradigms
Teamwork and give back to the community
Alone we can do so little; together we can do so much
Helen Keller
Conclusions
• Don't need to wait more to open your mind
• Try to learn new things to avoid burn out
• Get out of Drupal island to learn and improve your skills
Thirst for knowledge is basic to be up to date
Resources
• Drupal modules: XAutoload, Composer Manager, Service container, Typed
Entity...
• Plug repository: https://github.com/Plug-Drupal
• Entity Boilerplate repository:
https://github.com/plopesc/entity_boilerplate
• Typed Entity repository:
https://github.com/mateu-aguilo-bosch/typed_entity
Thanks!
Questions?

More Related Content

PDF
PDF
Introduction to drupal
ODP
Drupal Themes
PDF
Drupal and the semantic web - SemTechBiz 2012
ODP
Drupal distribution
PDF
Introduction to Drupal for Absolute Beginners
PDF
Beyond the Beginner - Path Ways to Advanced Drupal Levels & Businesses
ODP
Drupal introduction
Introduction to drupal
Drupal Themes
Drupal and the semantic web - SemTechBiz 2012
Drupal distribution
Introduction to Drupal for Absolute Beginners
Beyond the Beginner - Path Ways to Advanced Drupal Levels & Businesses
Drupal introduction

Viewers also liked (8)

PDF
Geohabilitación de gestores contenidos: CMSMap
PPTX
Gestores de contenidos web
PDF
Wordpress: De un Blog a un CMS
ODP
Arquitectura de la Información. Usabilidad.
PPS
Aw 04 powerpoint
PPTX
Gestores de contenidos
ODP
Diseño centrado en el usuario
ODP
Concepto de Gestión de Contenidos
Geohabilitación de gestores contenidos: CMSMap
Gestores de contenidos web
Wordpress: De un Blog a un CMS
Arquitectura de la Información. Usabilidad.
Aw 04 powerpoint
Gestores de contenidos
Diseño centrado en el usuario
Concepto de Gestión de Contenidos
Ad

Similar to D7 as D8 (20)

PDF
Drupal 7 migrating to drupal 8
PDF
Drupal 8, Where Did the Code Go? From Info Hook to Plugin
PPTX
PDF
Drupal 8 - Core and API Changes
PDF
Drupal 8 Deep Dive: Plugin System
PDF
Your Entity, Your Code
PDF
Your Entity, Your Code
PDF
Dependency injection in Drupal 8
PPTX
Ready. Set. Drupal! An Intro to Drupal 8, Part 2
PPTX
Top 8 Improvements in Drupal 8
PPTX
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
PPTX
Migrate yourself. code -> module -> mind
PDF
From Procedural to Object-Oriented PHP in Drupal
PDF
Your first d8 module
PDF
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
PDF
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
PPT
Synapse india reviews on drupal 7 entities (stanford)
PDF
Drupal 8 deeper dive
PDF
Entities, Bundles, and Fields: You need to understand this!
PDF
Migrate 140123161042-phpapp02
Drupal 7 migrating to drupal 8
Drupal 8, Where Did the Code Go? From Info Hook to Plugin
Drupal 8 - Core and API Changes
Drupal 8 Deep Dive: Plugin System
Your Entity, Your Code
Your Entity, Your Code
Dependency injection in Drupal 8
Ready. Set. Drupal! An Intro to Drupal 8, Part 2
Top 8 Improvements in Drupal 8
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Migrate yourself. code -> module -> mind
From Procedural to Object-Oriented PHP in Drupal
Your first d8 module
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
Synapse india reviews on drupal 7 entities (stanford)
Drupal 8 deeper dive
Entities, Bundles, and Fields: You need to understand this!
Migrate 140123161042-phpapp02
Ad

More from Pablo López Escobés (10)

PPTX
When Drupal met CARTO
PDF
Drupal 8: Fields reborn
PDF
Get on with Field API
PDF
API como SaaS
PDF
MADs about Drupal: Programación de entities para D7
PDF
Poniendo a drupal en el mapa
PDF
Integración de APIs políglotas de mapas en Google Web Toolkit: IDELabMapstrac...
PDF
Definición e implementación de soluciones basadas en APIs universales para la...
PDF
IDELab MapstractionInteractive: API Universal y Políglota
PDF
Drupal & GIS: Convirtiendo Drupal en un GeoCMS
When Drupal met CARTO
Drupal 8: Fields reborn
Get on with Field API
API como SaaS
MADs about Drupal: Programación de entities para D7
Poniendo a drupal en el mapa
Integración de APIs políglotas de mapas en Google Web Toolkit: IDELabMapstrac...
Definición e implementación de soluciones basadas en APIs universales para la...
IDELab MapstractionInteractive: API Universal y Políglota
Drupal & GIS: Convirtiendo Drupal en un GeoCMS

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPT
Introduction Database Management System for Course Database
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
AI in Product Development-omnex systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Online Work Permit System for Fast Permit Processing
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Transform Your Business with a Software ERP System
PDF
medical staffing services at VALiNTRY
DOCX
The Five Best AI Cover Tools in 2025.docx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
ai tools demonstartion for schools and inter college
PDF
System and Network Administration Chapter 2
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Introduction to Artificial Intelligence
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Introduction Database Management System for Course Database
Softaken Excel to vCard Converter Software.pdf
AI in Product Development-omnex systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Online Work Permit System for Fast Permit Processing
2025 Textile ERP Trends: SAP, Odoo & Oracle
VVF-Customer-Presentation2025-Ver1.9.pptx
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
How to Migrate SBCGlobal Email to Yahoo Easily
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Transform Your Business with a Software ERP System
medical staffing services at VALiNTRY
The Five Best AI Cover Tools in 2025.docx
Odoo POS Development Services by CandidRoot Solutions
ai tools demonstartion for schools and inter college
System and Network Administration Chapter 2
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Introduction to Artificial Intelligence
How to Choose the Right IT Partner for Your Business in Malaysia

D7 as D8

  • 1. D7 as D8 Pablo López Escobés #D7asD8
  • 2. Mateu Aguiló Senior developer at Lullabot e0ipso Pablo López Developer at Bluespark plopesc Team
  • 3. I came to talk about my module!
  • 5. Motivations • Learn about Drupal 8 • Improve our skills • Experimentation • No need to waste free time or money • Have fun
  • 6. We are not discovering sliced bread • There are already modules helping us: • X Autoload, Composer manager, Service Container • Other people is writing blog posts about this: • https://www.previousnext.com.au/tags/drupal-8-now • http://cambrico.net/drupal/using-composer-to-build-your-drupal-7- projects
  • 7. Why Plugins? • Plugins are a key component in D8 • Field types, Entity types, Image effects... • D8 plugin system is Drupal agnostic (lib/Drupal/Component folder) • A lot of problems can be solved using plugins It started with basic plugins, but then it spread! We created Plug Family
  • 8. Plug architecture • Packagist package created from D8 source code: drupal/d7-plugin • Download and register the package to be used via Composer manager • Plug module provides some glue code to integrate the plugin system • Register PSR-4 namespace for classes via X Autoload • Base classes to make easier the plugin creation
  • 9. Plugin discovery types Annotation based plugins Plugin classes are annotated and placed in a defined namespace. Class Acme: namespace Drupalplug_examplePlugincompany; /** * @Company( * id = "acme", * country = "USA" * ) */ class Acme extends CompanyBase implements CompanyInterface {
  • 10. Plugin discovery types YAML based discovery Plugins are listed in YAML files. This is mainly useful if all plugins use the same class. Class Fruit: apple: label: Apple sugar: 'low' namespace Drupalplug_examplePluginfruit; class Fruit extends PluginBase implements FruitInterface {
  • 11. Plug Field • Emulate the Drupal 8 Field System • Expose Field types, widgets and formatters as annotated plugins • Provide base classes to extend easily
  • 12. Plug Config • Create exportable entities as annotated plugins • Wrapper around Drupal 7 entities • Alternative to CTools plugins: • Object Oriented Plugins • Actually are entities
  • 13. Typed Entity (does not need Plug) • Organize your custom code around entities in objects • Forget my_module_process_article_images($nid) • Use $article->processImage() instead • It's a very lightweight module. Can complement Plug • More re-use of code: Code is centralized & You can use base classes • Objects are easy to pass around
  • 14. Typed Entity: Example code 1. Create the class with your custom methods 2. Use that object in your regular Drupal code namespace Drupalmy_moduleTypedEntity; class TypedNodeArticle extends TypedNode implements TypedNodeInterface { function hook_drupalcamp_blow_mind($node) { $article = TypedEntityManager::create('node', $node); foreach ($article->getRelatedArticles() as $related) { // $related->getImage() returns a TypedFileImage! $image_urls[] = $related->getImage()->getUrl(); } }
  • 15. Use case example Somos twisters billing system • NGO fundraising company • Manage multiple non profit companies • Complex bonus system for callers • Multiple roles
  • 16. Hot topics • Custom plugins for different billing calculators • Plug • Multiple custom entity types • Entity boilerplate • Custom field types for bonuses and penalties • Plug Field
  • 17. Field diagram • 7 Field type classes • 1 main abstract class • 4 Interfaces • Extra features for invoicing tasks
  • 18. I did it in a.module file
  • 20. Why we do love this stuff • Maintainability • Have fun learning a new way to solve problems • Investigate and discover new programming patterns • Be ready for all the new Drupal 8 coding paradigms Teamwork and give back to the community Alone we can do so little; together we can do so much Helen Keller
  • 21. Conclusions • Don't need to wait more to open your mind • Try to learn new things to avoid burn out • Get out of Drupal island to learn and improve your skills Thirst for knowledge is basic to be up to date
  • 22. Resources • Drupal modules: XAutoload, Composer Manager, Service container, Typed Entity... • Plug repository: https://github.com/Plug-Drupal • Entity Boilerplate repository: https://github.com/plopesc/entity_boilerplate • Typed Entity repository: https://github.com/mateu-aguilo-bosch/typed_entity