Jump to content

Admin Process Module Location


joer80
 Share

Recommended Posts

I saw a post on the forum that shows how to do a custom admin process wire module but it puts it in the "/wire/modules/" directory which adds it to the core tab.

If I want to do a new admin process module, can I put it in the "/site/modules/" folder instead, and still select it as a process on an admin page?

Thanks!

Link to comment
Share on other sites

Yes. Everything custom should go to /site/xxxx. This way, on updating ProcessWire, nothing gets overwritten (i.e. /wire/ is overwritten on updating PW).

Just curious, what custom module is that that was placed in /wire/modules?

Link to comment
Share on other sites

Thanks for posting. I see nowhere on that whole thread any instruction to put anything in "/wire/modules/". Ryan especially wouldn't say that :D....What the post says, in short, is that if you want a menu link to appear somewhere in the main Admin menu, just create a new child page of Admin. It will automatically be listed up there with 'Setup', 'Pages', etc. Of course, that link leads somewhere...e.g. a ProcessModule. In that case, the page will normally be created within your ProcessModule on install and not you doing it manually...

  • Like 2
Link to comment
Share on other sites

The forum post mentioned "/site/modules/", and that is where I uploaded it, and it still found it in the core tab!  

That is why I got confused!

So basically what I am seeing is, I upload a module to the site folder, and it adds it to the wire/core tab instead of the site tab when you are on the /admin/module/ page!

Link to comment
Share on other sites

In case it is a bug, I am running ProcessWire 2.4.0


It looks like it picks it up in the wire tab, but if you click install it fails because the file is not there.  (It is in the site folder.)

This is the error if you click install:   Error: Class 'readCSV' not found (line 565 of /home/(removed)/public_html/goac/wire/core/Modules.php) 

This is what is in the file: /site/modules/readCSV.module

<?

 
class ProcessReadCSV extends Process {
 
    public static function getModuleInfo() {
        return array(
            'title' => 'Read CSV',
            'summary' => 'This Module Reads the csv files under the csv page.',
            'version' => 001,
            );
    }
 
    public function execute() {
        return "<p><a href='./hi'>hi</a> or <a href='./bye'>bye</a></p>";
    }
 
    public function executeHi() {
        $this->message("Well hello"); 
        return "<p>You clicked hi!</p>";
    }
 
    public function executeBye() {
        $this->setFuel('processHeadline', 'Goodbye?'); 
        $this->error('Not so fast!'); 
        return "<p>You clicked bye!</p>";
    }
}
 
 
?>
Link to comment
Share on other sites

I wonder if it could be because I named it "class ProcessReadCSV" and the Process part is making the cms think it is a core module?

Update:  I just tested it, and renameing the class file fixes it!

So changing:

class ProcessReadCSV extends Process {
 
to
class ReadCSV extends Process {
 
Does in fact move it from the wire tab to the site tab.  (Even if the file is physically located in the site tab.
 
So doing the example posted in that forum will cause an error when you install the module!   :D
Link to comment
Share on other sites

No, naming modules ProcessXxx doesn't move them to core tab. You probably saw it in core tab if you had it in wire folder first - module information gets cached.

Also filename and classname should match. In your case ProcessReadCsv.module and class ProcessReadCsv

  • Like 1
Link to comment
Share on other sites

That is what I am saying.   :)   I never uploaded to the wire tab.   And I can shoot it both places by updating the file in the site folder.  When I change the class name, it moves from tab to tab.   :)

I am pretty sure you are correct and the bug is because I named the file readCSV.module and the class ProcessReadCSV and that caused it to go to the core tab?

As soon as they are both  readCSV it moves to the site tab!

Link to comment
Share on other sites

In the example in the forum, he had the file named ProcessHello.module and the class name ProcessHello, so it is correct!

My issue was because my class name did not match my filename as apeisa suggested.  Now that both match on mine, it is working now!   Thanks for your helps guys!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...