I'd recommend referring to the following blogs before proceeding further: Step-by-Step Guide to Creating a Controller in Drupal 8/9/10 Step-by-Step Guide to Creating a Custom Module in Drupal 9 You can use controllers to generate dynamic pages and return content in response to user requests. Sometimes, you may need to display...
When we are working on MVC (or MVVM for AngularJS) Design-Patterns, our application is loosely coupled because of different independent components defined for e.g. Controller, View, Services, Modal/Data etc. All the components have their own work/role but today we will discuss only Services. Services are that part of application where...
Many a times, we see a requirement, where we have to write same functions in multiple controllers just to share a common functionality among them, which is a bad approach, because in future, if any changes are required to that function, we’ll have to make the changes manually in all the copies of that function where it is defined or if...