Package and new Job installation

Permalink
Is it possible to install a new job from a package ?

I'm looking for a Job method like the installBlockTypeFromPackage for BlockType...

dgaussin
 
andrew replied on at Permalink Reply
andrew
Unfortunately it isn't at this time. We'd like to do some tweaking and cleanup to Jobs as a whole, so we will put this on our roadmap.
dgaussin replied on at Permalink Reply
dgaussin
I'm looking to install a new model now...

Try to read the concrete/controllers/install.php but no hint inside...

Thanks.

Edit: Ok, just found I can load a model from a specific package ;)

void   model  ( $mod, [ $pkgHandle = null])
dgaussin replied on at Permalink Reply
dgaussin
I'm trying to add a dashboard controller now...

I've a my_controller.php in concrete/controllers/dashboard/ and I'd like to add this in my package. Is it possible ?

The my_controller.php is automatically called in the dashboard to delete a new object from my package.
andrew replied on at Permalink Reply
andrew
First, for testing, you should be working in the local directory, rather than the concrete directory. Otherwise you may not be able to test everything/install everything through the dashboard.

If your new page is going to be available at /dashboard/my_test_page/ you'll want to create

single_pages/dashboard/my_test_page.php
controllers/dashboard/my_test_page.php

in the root directory, and install them through the single pages installation form in the "pages and themes" section. Just enter "/dashboard/my_test_page" in the text box under "add single page."

Finally, you'll be able to add this to a package, yes. Basically the syntax will be moving all the single pages and their controllers into your package, keeping the same directory structure. Then you'll have code that's something like:

Loader::model('single_page');
$p = SinglePage::add('/dashboard/my_test_page', $pkg);

from within your package (that's how the $pkg.)

Check out the tutorials on creating packages, and using single pages in the developer documentation if you want more guidance.
dgaussin replied on at Permalink Reply
dgaussin
Thanks andrew. Everything works now but even reading the tutorial, it's not clear when you start to develop on c5.
CodeMonkey replied on at Permalink Reply
CodeMonkey
Thank you SOOOO much for adding your comment about loading a model from a specific package. This was driving me CRAZY!
scalait replied on at Permalink Reply
scalait
Is it possible in the next release to install jobs from packages?