Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1885

Joomla! 4.x Coding • Add “own controller” to com_users Admin Component

$
0
0
I'm following "How to change Joomla without Core Hacks"
Part #6 "Component with “own controller”"
https://www.jug010.nl/images/presentati ... ehacks.pdf

But, When I use my overridden form, the original controller executes, not my "own" controller. How to I get Joomla to use my "own" controller?

Below is what I have developed so far.
I have also put full copies of the 3 files on github, if you want to see the code, here: https://github.com/Kimball31/MassMail

I used the Joomla Create Template Overrides tools to override the /com_users/mail component.
That created the new file: /atum/html/com_users/mail/default.php

I made copies the controller and model, as unique filenames for my "own" controller and model.
The new files for that are:
/administrator/components/com_users/src/Model/MailIndividualModel.php
/administrator/components/com_users/src/Controller/MailIndividualController.php

I then update the "task" in the default.php form, and modified the class names and some of the methods in my "own" controller and module.

changed default.php:

Code:

//from: <input type="hidden" name="task" value="">//to:<input type="hidden" name="task" value="MailIndividual">
changed /src/Model/MailIndividualModel.php:

Code:

//from:class MailModel extends AdminModel//to:class MailIndividualModel extends AdminModel
Changed /src/Controller/MailIndividualController.php

Code:

//from:class MailController extends BaseController//to:class MailIndividualController extends BaseController
I'm still missing something. The form does not execute the MailIndividualController.

Statistics: Posted by Kimball31 — Mon Mar 11, 2024 6:21 pm



Viewing all articles
Browse latest Browse all 1885

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>