Drupal 8 Vocab Lesson

  • 1,826 views
Uploaded on

When you're getting to know (and love?) Drupal 8, you might hear a lot of words that you pretend to understand. It's OK, just check in here for the down-low on those headscratchers. This lesson in …

When you're getting to know (and love?) Drupal 8, you might hear a lot of words that you pretend to understand. It's OK, just check in here for the down-low on those headscratchers. This lesson in Drupal 8 vocabulary covers these fun phrases...
- YAML
- Composer
- PSR-0
- Dependency Injection
- Service Containers
- Routing

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,826
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
31
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Drupal 8 vocab lesson Mediacurrent Team Knowledge Share Derek DeRaps 2013-07-30
  • 2. Agenda ● ● ● ● ● ● YAML Composer PSR-0 Dependency Injection Service Containers Routing
  • 3. define: “yammel”
  • 4. YAML ● ● ● ● “Yet Another Markup Language” “YAML Ain't Markup Language” Used to define .info files and other configuration Hands-on: ○ Let’s create a .info file for our error_notifier module
  • 5. define: Composer
  • 6. Composer ● “Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.” ● In Drupal-speak: Does the work formerly handled by the Libraries module (and much more). ● Important links: ○ https://getcomposer.org/installer ○ http://packagist.org ● Hands-on: ○ Let’s add the Swiftmailer library to our project.
  • 7. define: PSR-0
  • 8. PSR-0 ● ● ● A standard for autoloading classes. No more includes() and requires() (for the most part). Classes’ namespaces correspond to their location on disk. ○ Your classes’ namespaces always start with Drupalyour_module ○ On disk, that looks like ○ docroot/modules/custom/your_module/lib/Drupal/your_module/Your Class.php ● Class names correspond to filename ○ class MyClass { … } resides in MyClass.php ● Hands-on ○ Let’s declare a namespace and use other classes in our demo.
  • 9. define: Dependency Injection
  • 10. Dependency Injection ● “Declaratively express dependencies in the class definition rather than instantiating them in the class itself.” ● E.g., pass a TransportInterface to the Mailer class; it doesn't need to know whether it’s using SMTP, Sendmail, etc. ● “The less your code knows, the more reusable it is.” ○ (Sometimes, being ignorant is a good thing.) ● DI aims to help make our code: ○ Clutter-free, Reusable, Testable ● Awesome DrupalCon session by Kat Bailey: ● https://portland2013.drupal.org/session/dependency-injection-drupal-8
  • 11. define: Service Containers
  • 12. Service Containers ● Service ○ any PHP object that performs some sort of "global" task ● Service Container (aka dependency injection container) ○ a PHP object that manages the instantiation of services (i.e. objects). ● Examples: ○ EventSubscriber (“listens” for events … “Observer” OO pattern) ● Hands-on: ○ Let’s create an EventSubscriber service to send mail on 404 errors. ○ This might replace logic in (D7) hook_page_delivery_callback_alter
  • 13. define: Routing
  • 14. Routing ● ● Think: hook_menu (which is still available FYI). Hands-on ○ Let’s declare a route and then implement its Controller.
  • 15. Thank You! Questions