Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Drupal: Rejoining the Herd

Drupal: Rejoining the Herd

Oliver Davies

June 11, 2016
Tweet

More Decks by Oliver Davies

Other Decks in Technology

Transcript

  1. @opdavies Senior Drupal Developer at Former Drupal Association employee Symfony

    hobbyist Drupal Bristol organiser, PHPSW and DrupalCamp Bristol co-organiser First PHP conference! Appnovation Technologies
  2. Purpose If you're new to Drupal, go and try it

    If you've used it before, re-try it
  3. About Drupal Drupal is an open source, PHP content management

    system 16 years old Drupal 8 was released in November 2015 Non-BC changes between major versions Mostly procedural code prior to D8 Drupalisms
  4. Entities(ish) Everything uses s t d C l a s

    s No consistency between models
  5. Hooks / / h e l l o . m

    o d u l e / * * * I m p l e m e n t s h o o k _ m e n u ( ) * / f u n c t i o n h e l l o _ m e n u ( ) { $ i t e m s [ ' h e l l o - w o r l d ' ] = a r r a y ( . . . ) ; r e t u r n $ i t e m s ; }
  6. Theme functions $ i t e m s [ l

    ( ' F o o ' , ' f o o ' ) , l ( ' B a r ' , ' b a r ' ) , ] ; r e t u r n t h e m e ( ' i t e m _ l i s t ' , [ ' i t e m s ' = > $ i t e m s ] ) ; < u l c l a s s = " i t e m - l i s t " > < l i > < a h r e f = " f o o " > F o o < / a > < / l i > < l i > < a h r e f = " b a r " > B a r < / a > < / l i > < / u l >
  7. Symfony Core developed using Symfony components Minimum PHP version requirement

    PHP code in classes No more functions (almost) Namespaces PSR-0 PSR-4 Autoloading Dependency injection Full test coverage Consistency!
  8. Symfony components ClassLoader Console CssSelector DependencyInjection EventDispatcher HttpFoundation HttpKernel Process

    Routing Serializer Translation Validator Yaml http://symfony.com/projects/drupal
  9. YAML example.info (D7) n a m e = E x

    a m p l e c o r e = 7 . x p a c k a g e = C u s t o m d e p e n d e n c i e s [ ] = e n t i t y f i l e s [ ] = a . i n c f i l e s [ ] = b . i n c example.info.yml (D8) n a m e : E x a m p l e t y p e : m o d u l e c o r e : 8 . x p a c k a g e : C u s t o m d e p e n d e n c i e s : - e n t i t y
  10. Routing (D7) hello.module f u n c t i o

    n h e l l o _ m e n u ( ) { $ i t e m s [ ' h e l l o - w o r l d ' ] = [ ' t i t l e ' = > ' H e l l o , P H P S C ' , ' p a g e c a l l b a c k ' = > ' h e l l o _ p a g e _ c a l l b a c k ' , ' a c c e s s a r g u m e n t s ' = > [ ' a c c e s s c o n t e n t ' ] , ] ; r e t u r n $ i t e m s ; }
  11. Routing (D8) hello.routing.yml h e l l o . v

    i e w : p a t h : / h e l l o - w o r l d d e f a u l t s : _ t i t l e : ' H e l l o , P H P S C ' _ c o n t r o l l e r : ' \ D r u p a l \ h e l l o \ C o n t r o l l e r \ P a g e C o n t r o l l e r : : h e l l o V i e w '
  12. Twig Default theme engine in D8 Replaces phptemplate No more

    database queries in templates No more theme functions
  13. Proudly found elsewhere jQuery * Symfony Symfony CMF CKEditor Zend

    Composer Stack Guzzle Twig PhpUnit http://cgit.drupalcode.org/drupal/tree/core/composer.json
  14. Composer Drupal 8 using Composer for dependency management and autoloading

    Better Composer support since 8.1 Composer integration on Drupal.org Drupal Composer projectroject template Project template Drupal Packagist
  15. Drupal via Composer " r e p o s i

    t o r i e s " : [ { " t y p e " : " c o m p o s e r " , " u r l " : " h t t p s : / / p a c k a g e s . d r u p a l . o r g / 8 " } ] , r e q u i r e : { " d r u p a l / c o r e " : " ~ 8 . 0 " } , . . . https://github.com/platformsh/platformsh-example-drupal/blob/8.x/composer.json
  16. Contrib - Symfony WebPro ler Bundle as a Drupal 8

    module - adds a GUI for Composer dependencies - PSR-4 support for Drupal 7 Web Pro ler Composer Manager xautoload
  17. Libraries rst Non-Drupal problems being xed outside of Drupal Framework

    agnostic PHP libraries Better exposure Production tested code Allows for backports
  18. Drupal Console A CLI tool for generating Drupal code and

    interacting with Drupal 8 websites Based on Symfony Console component PSR-2 coding style, outputs Drupal code style http://drupalconsole.com
  19. In Summary Lowered the barrier to entry for PHP Developers

    Made me a better Developer More transferable knowledge and skills Changed perspective
  20. DrupalCamp Bristol 22nd - 24th July phpsc-fri - £20 off

    the business day phpsc-sat - £5 off the conference day https://www.drupalcampbristol.co.uk