This is tutorial #3 in the Drupal Commerce tutorial series. In this post, you will learn how to add fields and other metadata to the Drupal Commerce Product. In this specific example, we'll add description and image fields. This information will be exposed on the product display page so that it appears next to Add to card button. We will also enable user reviews and ratings.
We'll start from where we left off in the previous article on [PHP Interfaces](/blog/drupal-8/interface). If you haven't read it, please go and read it now, or get the free eBook on object-oriented programming from the right sidebar (below the content if you are viewing in mobile). In previous article on PHP Interfaces, we made `HondaAccord` class implement the `ContainerInterface` because it has a trunk. As a result, we could use `HondaAccord` class wherever `ContainerInterface` is used. But the code looks ugly!
If you are starting to learn about Drupal 8, you must have come across a term called "Dependency Injection". If you are wondering what it means, then this is the post you should read. Through examples, you will learn why dependency injection is useful for decoupling the code as well as unit testing effectively.
If you are starting to learn Drupal 8, you are probably overwhelmed by the number of blog posts that offer free tutorials on different aspects of Drupal 8. The only way to find all these tutorials is to search online. In this post, we have created an exhaustive list of the free resources online for mastering Drupal 8, organized by categories. Use these links as a reference when starting on your next Drupal 8 learning expedition. Perform a Ctrl+F search to quicky find the topic of your choice.
In Object Oriented PHP Programming post, you learned how to create classes and objects and how to use them in your code. In this post, we'll dig a little deeper and introduce the concept of inheritance. You will understand when to use it and the benefits associated with its use. You will understand Method Overriding in PHP. You will also learn when to set the visibility of properties and methods to public, protected or private. We'll continue where we left off in the previous post.
I am sure that by now you must have heard that Drupal 8 is using Symfony components and is based on object-oriented programming in PHP. If you are a Drupal 7 developer, then you may not know what is object-oriented programming or fail to understand the benefits it offers. In this post, you will learn the basics of object-oriented PHP programming so that you can start developing for Drupal 8.
Devel module provides dsm() and dpm() functions to output variables on the page for debugging Drupal. But if the problem is more complicated, then that's not sufficient. You can simplify debugging tremendously if you stop code execution using breakpoints and then execute the application one step at a time. All IDEs that support PHP debugging, such as Eclipse, Netbeans, PHPStorm, etc., provide the functionality to put breakpoints in the code. But it requires quite a bit of configuration to make it work.
In What is headless Drupal post, you learned what exactly is headless Drupal. You also understood the two ways a headless Drupal application can be developed. You got to know of the advantages and disadvantages of both the approaches. In this post, you will create the simplest headless Drupal application possible in less than 15 minutes. By the end of this post, you will have a simple HTML page. On loading this page, JS will send a request to Drupal. Drupal will generate a random number and send it back to the JS.
Start with learning object-oriented PHP that you need to understand Drupal 8 code. The free eBook covers:
Can highly recommend the @redcrackle Drupal 8 #OOP intro found at /blog . Also available as handy PDF. Very well written!