Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Developing Extensions for Joomla! 5

You're reading from   Developing Extensions for Joomla! 5 Extend your sites and build rich customizations with Joomla! plugins, modules, and components

Arrow left icon
Product type Paperback
Published in Nov 2023
Publisher Packt
ISBN-13 9781804617991
Length 322 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Carlos M. Cámara Mora Carlos M. Cámara Mora
Author Profile Icon Carlos M. Cámara Mora
Carlos M. Cámara Mora
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Developing Components
2. Chapter 1: Planning Your Component FREE CHAPTER 3. Chapter 2: Developing the Backend of a Basic Joomla! Component 4. Chapter 3: Developing the Frontend of a Basic Joomla! Component 5. Chapter 4: Creating Forms in Joomla! 6. Chapter 5: Harnessing the Power of Joomla! in Your Component 7. Chapter 6: Adding a Web Service API to Your Component 8. Part 2: Developing Modules and Plugins
9. Chapter 7: Developing a Module 10. Chapter 8: Developing a Joomla! Plugin 11. Chapter 9: Adding a CLI to Your Extension 12. Part 3: Extending Templates
13. Chapter 10: Creating Unique Web Applications with Template Overrides 14. Chapter 11: Creating a Child Template in Joomla! 15. Part 4: Distributing Your Extensions
16. Chapter 12: Testing Your Extensions 17. Chapter 13: Security Practices in Joomla! 18. Chapter 14: Distributing Your Joomla! Extensions 19. Index 20. Other Books You May Enjoy

Adding parameters to your CLI command

Our CLI application is very useful to get a quick view of the upcoming deadlines within a week, but what about the upcoming deadlines for the month? We could just change the time parameter in our SQL query, but that would not be very practical, so let’s add arguments to our CLI command to allow for better flexibility.

We’ll add an option to our command to pass the number of days we want to consider for the deadline.

As we saw in the previous section, Introducing generic options for Joomla! CLI, we added two dashes before the name of the option. We are calling our option days, so our command will look like this:

php joomla.cli spm:task:deadline --days 7

Here, we can replace 7 with any number of days when executing our command.

Joomla! provides several interesting methods to make it easier to define these CLI options. Let’s start editing the src/plugins/console/spm/src/CliCommand/SpmTaskDeadlineCommand.php file...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime