Module Development

Restrict Visibility and Access for Drupal 8, 9

Sprout Video

In this tutorial, I will show you the difference between public, private, and protected methods or properties in PHP classes. By the end of this lesson you will learn how to make things private at first, protected once you need to access them in a subclass, and public when you need to use it outside of its class and subclass.

Additional resources

Visibility (PHP Manual)